You are here

function devel_query_debug_alter in Devel 8

Same name and namespace in other branches
  1. 8.3 devel.module \devel_query_debug_alter()
  2. 8.2 devel.module \devel_query_debug_alter()
  3. 7 devel.module \devel_query_debug_alter()
  4. 4.x devel.module \devel_query_debug_alter()

Implements hook_query_TAG_alter().

Makes debugging entity query much easier.

Example usage:

$query = \Drupal::entityQuery('node');
$query
  ->condition('status', NODE_PUBLISHED);
$query
  ->addTag('debug');
$query
  ->execute();

File

./devel.module, line 625
This module holds functions useful for Drupal development. Please contribute!

Code

function devel_query_debug_alter(AlterableInterface $query) {
  if (!$query
    ->hasTag('debug-semaphore')) {
    $query
      ->addTag('debug-semaphore');
    dpq($query);
  }
}