开发者

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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜