protected function CommerceTurnoverSensorPlugin::getEntityQueryAggregate in Monitoring 8
Builds the entity aggregate query.
Return value
\Drupal\Core\Entity\Query\QueryAggregateInterface The entity query object.
Overrides ContentEntityAggregatorSensorPlugin::getEntityQueryAggregate
File
- src/
Plugin/ monitoring/ SensorPlugin/ CommerceTurnoverSensorPlugin.php, line 92
Class
- CommerceTurnoverSensorPlugin
- Monitors commerce order turnover stats.
Namespace
Drupal\monitoring\Plugin\monitoring\SensorPluginCode
protected function getEntityQueryAggregate() {
$query = parent::getEntityQueryAggregate();
$query
->aggregate('total_price.number', 'SUM');
$query
->condition('total_price.currency_code', $this->sensorConfig
->getSetting('commerce_order_currency'));
if ($paid_states = array_filter($this->sensorConfig
->getSetting('commerce_order_paid_states'))) {
$query
->condition('state', $paid_states, 'IN');
}
return $query;
}