public QueryBase::aggregate($field, $function, $langcode = NULL, &$alias = NULL)
Specifies a field and a function to aggregate on.
Available functions: SUM, AVG, MIN, MAX and COUNT.
@todo What about GROUP_CONCAT support?
string $field: The name of the field to aggregate by.
string $function: The aggregation function, for example COUNT or MIN.
string $langcode: (optional) The language code.
string $alias: (optional) The key that will be used on the resultset.
\Drupal\Core\Entity\Query\QueryAggregateInterface The called object.
Overrides QueryAggregateInterface::aggregate
public function aggregate($field, $function, $langcode = NULL, &$alias = NULL) { if (!isset($alias)) { $alias = $this->getAggregationAlias($field, $function); } $this->aggregate[$alias] = array( 'field' => $field, 'function' => $function, 'alias' => $alias, 'langcode' => $langcode, ); return $this; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Query!QueryBase.php/function/QueryBase::aggregate/8.1.x