Last active
November 29, 2019 15:59
-
-
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) :
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
<?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