Skip to content

Instantly share code, notes, and snippets.

@kcassam
Last active November 29, 2019 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kcassam/55b2cc786ef182cfdff33640e450412e to your computer and use it in GitHub Desktop.
Save kcassam/55b2cc786ef182cfdff33640e450412e to your computer and use it in GitHub Desktop.
Fonction pour voir une requête sql à partir d'une query doctrine (version testée) :
<?php
//Pour voir une requête sql à partir d'une query doctrine (version testée) :
function getQueryString(\Doctrine\ORM\Query $query):string
{
foreach ($query->getParameters() as $p) {
$params[] = $p->getValue();
}
return vsprintf(str_replace('?', '"%s"', $query->getSql()), $params);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment