Skip to content

Instantly share code, notes, and snippets.

@bshaffer
Created March 30, 2010 19:42
Show Gist options
  • Save bshaffer/349506 to your computer and use it in GitHub Desktop.
Save bshaffer/349506 to your computer and use it in GitHub Desktop.
Output the actual SQL query from a Doctrine_Query object
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