Last active
August 29, 2015 14:05
-
-
Save rodmcnew/3133bce70c2f5f606957 to your computer and use it in GitHub Desktop.
Easily see what queries doctrine is running for a page load
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
<?php | |
/** | |
* Inside doctrine locate the executeQuery() method inside the \Doctrine\DBAL\Connection class. | |
* ADD THE FOLLOWING TO THE BEGINNING OF THE executeQuery() METHOD: | |
*/ | |
/** | |
* ADDED TO PROFILE QUERIES | |
*/ | |
if (!isset($GLOBALS['queryCount'])) { | |
$GLOBALS['queryCount'] = 0; | |
} | |
$GLOBALS['queryCount']++; | |
var_dump($GLOBALS['queryCount'], $query, $params); | |
echo('<hr>'); | |
if ($qcp !== null) { | |
return $this->executeCacheQuery($query, $params, $types, $qcp); | |
} | |
/** | |
* END ADDED TO PROFILE QUERIES | |
*/ | |
/** | |
* Output in the browser will look like: | |
* int 31 | |
* string 'SELECT r0_.defaultText AS defaultText0, r0_.text AS text1 FROM rcmi18n_message r0_ WHERE r0_.locale = ?' (length=103) | |
* array (size=1) | |
* 0 => string 'en_US' (length=5) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment