You are here

public function OrderReport::buildQuery in Commerce Reporting 8

Builds the aggregate query.

Report type plugins should add their field columns, aggregates, and groupBy statements here.

Parameters

\Drupal\Core\Entity\Query\QueryAggregateInterface $query: The aggregate query.

Overrides ReportTypeInterface::buildQuery

File

src/Plugin/Commerce/ReportType/OrderReport.php, line 73

Class

OrderReport
Provides the basic Order Report.

Namespace

Drupal\commerce_reports\Plugin\Commerce\ReportType

Code

public function buildQuery(QueryAggregateInterface $query) {
  $query
    ->aggregate('mail', 'COUNT');
  $query
    ->aggregate('amount.number', 'SUM');
  $query
    ->aggregate('amount.number', 'AVG');
  $query
    ->groupBy('amount.currency_code');
}