smoreno
smoreno

Reputation: 3530

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?

Upvotes: 4

Views: 1730

Answers (1)

Ocramius
Ocramius

Reputation: 25431

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

Upvotes: 11

Related Questions