function Sql::getAggregationInfo

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::getAggregationInfo()
  2. 8.9.x core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::getAggregationInfo()
  3. 10 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::getAggregationInfo()

Overrides QueryPluginBase::getAggregationInfo

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

File

core/modules/views/src/Plugin/views/query/Sql.php, line 1764

Class

Sql
Views query plugin for an SQL query.

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 [
        'group' => [
            'title' => $this->t('Group results together'),
            'is aggregate' => FALSE,
        ],
        'count' => [
            'title' => $this->t('Count'),
            'method' => 'aggregationMethodSimple',
            'handler' => [
                'argument' => 'groupby_numeric',
                'field' => 'numeric',
                'filter' => 'groupby_numeric',
                'sort' => 'groupby_numeric',
            ],
        ],
        'count_distinct' => [
            'title' => $this->t('Count DISTINCT'),
            'method' => 'aggregationMethodDistinct',
            'handler' => [
                'argument' => 'groupby_numeric',
                'field' => 'numeric',
                'filter' => 'groupby_numeric',
                'sort' => 'groupby_numeric',
            ],
        ],
        'sum' => [
            'title' => $this->t('Sum'),
            'method' => 'aggregationMethodSimple',
            'handler' => [
                'argument' => 'groupby_numeric',
                'field' => 'numeric',
                'filter' => 'groupby_numeric',
                'sort' => 'groupby_numeric',
            ],
        ],
        'avg' => [
            'title' => $this->t('Average'),
            'method' => 'aggregationMethodSimple',
            'handler' => [
                'argument' => 'groupby_numeric',
                'field' => 'numeric',
                'filter' => 'groupby_numeric',
                'sort' => 'groupby_numeric',
            ],
        ],
        'min' => [
            'title' => $this->t('Minimum'),
            'method' => 'aggregationMethodSimple',
            'handler' => [
                'argument' => 'groupby_numeric',
                'field' => 'numeric',
                'filter' => 'groupby_numeric',
                'sort' => 'groupby_numeric',
            ],
        ],
        'max' => [
            'title' => $this->t('Maximum'),
            'method' => 'aggregationMethodSimple',
            'handler' => [
                'argument' => 'groupby_numeric',
                'field' => 'numeric',
                'filter' => 'groupby_numeric',
                'sort' => 'groupby_numeric',
            ],
        ],
        'stddev_pop' => [
            'title' => $this->t('Standard deviation'),
            'method' => 'aggregationMethodSimple',
            'handler' => [
                'argument' => 'groupby_numeric',
                'field' => 'numeric',
                'filter' => 'groupby_numeric',
                'sort' => 'groupby_numeric',
            ],
        ],
    ];
}

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