Skip to content

Instantly share code, notes, and snippets.

@gobinathm
Created March 3, 2017 19:59
Show Gist options
  • Save gobinathm/06e81e1a963de21eb533a1bca834bc0f to your computer and use it in GitHub Desktop.
Save gobinathm/06e81e1a963de21eb533a1bca834bc0f to your computer and use it in GitHub Desktop.
Debugging Entity Field Query by Displaying the Query as a string
function MYMODULE_query_alter($query) {
  if ($query->hasTag('entitydebug')) {
    dpm((string)$query);
  }
}

###Add the TAG in EntityFieldQuery

$q = new EntityFieldQuery;
$q->entityCondition('entity_type', 'node')
  ->addTag('entitydebug')
  ->execute();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment