Reputation: 1081
Situation:
$queryBuilder
->addSelect( /* hardlyPredictableSelectString() */ )
->leftjoin ( /* hardlyPredictableJoinString() */ )
->andWhere ( /* hardlyPredictableWhereString() */ )
->getQuery()
->getResult()
I want to debug that query, but it is hardly to predictable. You know, if, else, add some text, or not... I can not simply echo $string, , so my question is:
How to make something like that? $queryString=getQueryString()
?
getDQLParts(); is not good idea, because, I want to simply copy and paste that string to custom MySQL Manager.
Upvotes: 2
Views: 85
Reputation: 5084
You should use symfony profiler, where You have Doctrine|Propel tab in which there is list of queries that was executed.
Upvotes: 0
Reputation: 3870
Just use getSql before getResult.
$query = $queryBuilder
->addSelect( /* hardlyPredictableSelectString() */ )
->leftjoin ( /* hardlyPredictableJoinString() */ )
->andWhere ( /* hardlyPredictableWhereString() */ )
->getQuery();
echo $query->getSql();
Upvotes: 3