开发者

Doctrine2 how to see a generated createQuery SQL Text (symfony2)

开发者 https://www.devze.com 2023-04-02 18:10 出处:网络
I would like to get the \'real\' SQL Query doctrine is passing to the SQL Server: <?php $em = $this->getDoctrine()->getEntityManager();

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

精彩评论

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