Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Doctrine Query to QueryBuilder object for add conditions

I have a Doctrine Query object returned by a service. Then I need to add some "wheres, order by and Limit" parts. Is posible convert a QUery Object to QueryBuilder Object? How I do it?

like image 616
smoreno Avatar asked Dec 20 '22 09:12

smoreno


1 Answers

You cannot convert a query object to a query builder. Once you have a query object, you can use:

$query->getDQL();

to retrieve the DQL for that query object, and once you manipulated it (it's a string, so it is up to you)

$query->setDQL($modifiedDql);
like image 186
Ocramius Avatar answered Jan 30 '23 13:01

Ocramius