Skip to content

Instantly share code, notes, and snippets.

@miteshmap
Created October 1, 2014 12:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miteshmap/10bd1c3bc98e9747eb6b to your computer and use it in GitHub Desktop.
Save miteshmap/10bd1c3bc98e9747eb6b to your computer and use it in GitHub Desktop.
alter entity field query to print for debug
/**
* Implements hook_query_alter().
*/
function evosys_redirect_query_alter($query) {
if ($query->hasTag('debug')) {
$sql = (string)$query;
$connection = Database::getConnection();
foreach ((array) $query->arguments() as $key => $val) {
$quoted[$key] = $connection->quote($val);
}
$sql = strtr($sql, $quoted);
dpr($sql);
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment