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

Breadcrumb

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

function 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();

API Navigation

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