function QueryAggregateInterface::execute

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Query/QueryAggregateInterface.php \Drupal\Core\Entity\Query\QueryAggregateInterface::execute()
  2. 8.9.x core/lib/Drupal/Core/Entity/Query/QueryAggregateInterface.php \Drupal\Core\Entity\Query\QueryAggregateInterface::execute()
  3. 10 core/lib/Drupal/Core/Entity/Query/QueryAggregateInterface.php \Drupal\Core\Entity\Query\QueryAggregateInterface::execute()

Executes the aggregate query.

Return value

array A list of result row arrays. Each result row contains the aggregate results as keys and also the groupBy columns as keys:

$result = $query->aggregate('nid', 'count')
    ->condition('status', 1)
    ->groupby('type')
    ->execute();

Will return:

$result[0] = [
    'count_nid' => 3,
    'type' => 'page',
];
$result[1] = [
    'count_nid' => 4,
    'type' => 'article',
];

Overrides QueryInterface::execute

File

core/lib/Drupal/Core/Entity/Query/QueryAggregateInterface.php, line 152

Class

QueryAggregateInterface
Defines an interface for aggregated entity queries.

Namespace

Drupal\Core\Entity\Query

Code

public function execute();

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