Created
March 30, 2010 19:42
-
-
Save bshaffer/349506 to your computer and use it in GitHub Desktop.
Output the actual SQL query from a Doctrine_Query object
This file contains hidden or 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
public function debug() | |
{ | |
$sql = $this->getSqlQuery(); | |
$params = $this->getParams(); | |
foreach ($params as $key => $type) | |
{ | |
foreach ($type as $param) | |
{ | |
$sql = preg_replace('/\?/', is_int($param) ? $param : "'$param'", $sql, 1); | |
} | |
} | |
return $sql; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment