Doctrine2 how to see a generated createQuery SQL Text (symfony2)
I would like to get the 'real' SQL Query doctrine is passing to the SQL Server:
<?php
$em = $this->getDoctrine()->getEntityManager();
$开发者_StackOverflow社区myQuery = $em->createQuery('SELECT v FROM ....... v');
echo $myQuery->???????
?>
What I must to write instead of ???????? characters ?
I have tried with getSQLQuery() and with getSQL() but no luck for now.
Thanks..
You were almost there, it's getSql, not getSQL:
$myQuery->getSql()
You could try this:
$myQuery->getResult();
See if it helps
$myQuery->getDql();
精彩评论