How to order by a computed value in DQL
问题 I'm trying to order the results of my query by whether or not they match my original entity on a property. I could do this easily in mySQL with the following query: SELECT * FROM table ORDER BY prop = 'value' DESC; However, in Doctrine, when I attempt the following: // $qb is an instance of query builder $qb->select('e') ->from('Entity', 'e') ->orderBy('e.prop = :value', 'DESC') ->setParameter('value', 'value'); // grab values I get a Doctrine syntax error, 'end of string'. I looked into