You are here

public function PhpNoticesSensorPlugin::getQuery in Monitoring 8

Builds the query for verbose output.

Similar to the aggregate query, but without aggregation.

Return value

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

Overrides DatabaseAggregatorSensorPlugin::getQuery

See also

\Drupal\monitoring\Plugin\monitoring\SensorPlugin\DatabaseAggregatorSensorPlugin::getAggregateQuery()

File

src/Plugin/monitoring/SensorPlugin/PhpNoticesSensorPlugin.php, line 64
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 getQuery() {
  $query = parent::getQuery();
  $query
    ->addField('watchdog', 'variables');
  $this
    ->addAggregateExpression($query);
  $query
    ->condition('type', 'php', NULL);
  $query
    ->groupBy('variables');

  // Drop the existing order, order by record count instead.
  $order =& $query
    ->getOrderBy();
  $order = [];
  $query
    ->orderBy('records_count', 'DESC');
  $query
    ->range(0, 20);
  return $query;
}