Skip to content

Instantly share code, notes, and snippets.

@rodmcnew
Last active July 14, 2016 17:11
Show Gist options
  • Save rodmcnew/6f9094b6e27318042a0dc22c1a54dc5d to your computer and use it in GitHub Desktop.
Save rodmcnew/6f9094b6e27318042a0dc22c1a54dc5d to your computer and use it in GitHub Desktop.
/**
* Paste this code at the top of \Doctrine\DBAL\Connection:executeQuery()
*/
$startTime = microtime(true);
//Body of \Doctrine\DBAL\Connection:executeQuery() goes here
/**
* Paste this code at the bottom of \Doctrine\DBAL\Connection:executeQuery()
*/
if (!isset($GLOBALS['doctrineLogQueryCount'])) {
$GLOBALS['doctrineLogQueryCount'] = 0;
}
$GLOBALS['doctrineLogQueryCount']++;
echo 'Query #' . $GLOBALS['doctrineLogQueryCount'] . ' ['
. round((microtime(true) - $startTime) * 1000) . 'ms]'
. '<br>' . $query . '<hr>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment