Created
October 1, 2014 12:35
-
-
Save miteshmap/10bd1c3bc98e9747eb6b to your computer and use it in GitHub Desktop.
alter entity field query to print for debug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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