function QueryAggregate::result

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php \Drupal\Core\Entity\Query\Sql\QueryAggregate::result()
  2. 10 core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php \Drupal\Core\Entity\Query\Sql\QueryAggregate::result()
  3. 11.x core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php \Drupal\Core\Entity\Query\Sql\QueryAggregate::result()

Overrides \Drupal\Core\Entity\Query\Sql\Query::result().

Return value

array|int Returns the aggregated result, or a number if it's a count query.

Overrides Query::result

File

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

Class

QueryAggregate
The SQL storage entity query aggregate class.

Namespace

Drupal\Core\Entity\Query\Sql

Code

protected function result() {
    if ($this->count) {
        return parent::result();
    }
    $return = [];
    foreach ($this->sqlQuery
        ->execute() as $row) {
        $return[] = (array) $row;
    }
    return $return;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.