Convert Doctrine Query to QueryBuilder object for add conditions

doctrine-orm, symfony, symfony-2.1

Solution

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

Problem

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?

Original source