Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. QueryAggregate.php

function QueryAggregate::addAggregate

Adds the aggregations to the query.

Return value

$this Returns the called object.

File

core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php, line 74

Class

QueryAggregate
The SQL storage entity query aggregate class.

Namespace

Drupal\Core\Entity\Query\Sql

Code

protected function addAggregate() {
    if ($this->aggregate) {
        foreach ($this->aggregate as $aggregate) {
            $sql_field = $this->getSqlField($aggregate['field'], $aggregate['langcode']);
            $sql_field_escaped = '[' . str_replace('.', '].[', $sql_field) . ']';
            $this->sqlExpressions[$aggregate['alias']] = $aggregate['function'] . "({$sql_field_escaped})";
        }
    }
    return $this;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal