public function Sql::getAggregationInfo

Get aggregation info for group by queries.

If NULL, aggregation is not allowed.

Overrides QueryPluginBase::getAggregationInfo

1 call to Sql::getAggregationInfo()
Sql::compileFields in drupal/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
Adds fields to the query.

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php, line 1582
Definition of Drupal\views\Plugin\views\query\Sql.

Class

Sql
@todo.

Namespace

Drupal\views\Plugin\views\query

Code

public function getAggregationInfo() {

  // @todo -- need a way to get database specific and customized aggregation
  // functions into here.
  return array(
    'group' => array(
      'title' => t('Group results together'),
      'is aggregate' => FALSE,
    ),
    'count' => array(
      'title' => t('Count'),
      'method' => 'aggregationMethodSimple',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
    'count_distinct' => array(
      'title' => t('Count DISTINCT'),
      'method' => 'aggregationMethodDistinct',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
    'sum' => array(
      'title' => t('Sum'),
      'method' => 'aggregationMethodSimple',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
    'avg' => array(
      'title' => t('Average'),
      'method' => 'aggregationMethodSimple',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
    'min' => array(
      'title' => t('Minimum'),
      'method' => 'aggregationMethodSimple',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
    'max' => array(
      'title' => t('Maximum'),
      'method' => 'aggregationMethodSimple',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
    'stddev_pop' => array(
      'title' => t('Standard deviation'),
      'method' => 'aggregationMethodSimple',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
  );
}