Skip to content

Instantly share code, notes, and snippets.

@opi
Created May 2, 2013 11:55
Show Gist options
  • Save opi/5501735 to your computer and use it in GitHub Desktop.
Save opi/5501735 to your computer and use it in GitHub Desktop.
Debug Drupal EntityFieldQuery
<?php
/**
* Implements hook_query_alter().
*
* Adds a tag management named "query_debug" that permits to retrieve
* the concerned request implementing this tag.
* Only for development use. Custom requests SHOULDN'T implement this tag in a
* production website.
*/
function mymodule_query_alter($query) {
if ($query->hasTag('query_debug') && module_exists('devel')) {
dpm(strtr((string) $query, $query->getArguments()));
}
}
@KeyboardCowboy
Copy link

I have something similar, but prevents duplication and uses the dpq() function from devel. https://gist.github.com/KeyboardCowboy/78a0c6def01f666c5f55d33712171e20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment