You are here

public function PhpNoticesSensorPlugin::getAggregateQuery in Monitoring 8

Builds simple aggregate query over one db table.

Return value

\Drupal\Core\Database\Query\Select The select query object.

Overrides DatabaseAggregatorSensorPlugin::getAggregateQuery

File

src/Plugin/monitoring/SensorPlugin/PhpNoticesSensorPlugin.php, line 50
Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\PhpNoticesSensorPlugin.

Class

PhpNoticesSensorPlugin
Displays the most frequent PHP notices and errors.

Namespace

Drupal\monitoring\Plugin\monitoring\SensorPlugin

Code

public function getAggregateQuery() {
  $query = parent::getAggregateQuery();
  $query
    ->addField('watchdog', 'variables');
  $query
    ->condition('type', 'php', NULL);

  // The message is the most recurring php error.
  $query
    ->groupBy('variables');
  $query
    ->orderBy('records_count', 'DESC');
  $query
    ->range(0, 1);
  return $query;
}