You are here

function Sql::get_aggregation_info in Views (for Drupal 7) 8.3

Get aggregation info for group by queries.

If NULL, aggregation is not allowed.

Overrides QueryPluginBase::get_aggregation_info

1 call to Sql::get_aggregation_info()
Sql::compile_fields in lib/Drupal/views/Plugin/views/query/Sql.php
Adds fields to the query.

File

lib/Drupal/views/Plugin/views/query/Sql.php, line 1649
Definition of Drupal\views\Plugin\views\query\Sql.

Class

Sql
@todo.

Namespace

Drupal\views\Plugin\views\query

Code

function get_aggregation_info() {

  // @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' => 'aggregation_method_simple',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
    'count_distinct' => array(
      'title' => t('Count DISTINCT'),
      'method' => 'aggregation_method_distinct',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
    'sum' => array(
      'title' => t('Sum'),
      'method' => 'aggregation_method_simple',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
    'avg' => array(
      'title' => t('Average'),
      'method' => 'aggregation_method_simple',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
    'min' => array(
      'title' => t('Minimum'),
      'method' => 'aggregation_method_simple',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
    'max' => array(
      'title' => t('Maximum'),
      'method' => 'aggregation_method_simple',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
    'stddev_pop' => array(
      'title' => t('Standard deviation'),
      'method' => 'aggregation_method_simple',
      'handler' => array(
        'argument' => 'groupby_numeric',
        'field' => 'numeric',
        'filter' => 'groupby_numeric',
        'sort' => 'groupby_numeric',
      ),
    ),
  );
}