Jira issue originally created by user sandermarechal:
$criteria = Criteria::create();
$criteria->orderBy(array('field' => Criteria::DESC));
$qb = $em->getRepository('Entity')->createQueryBuilder('e');
[Semantical Error] line 0, col 53 near 'field DESC': Error: 'field' is not defined.
Comment created by @ocramius:
What is the generated DQL? And is it valid?
Comment created by sandermarechal:
The generated DQL comes out as "SELECT e FROM Entity e ORDER BY field DESC". I think it's missing the entity alias in the order by clause.
If you want I can create a Pull Request with a failing test case for this. I just have no idea how I should go about fixing this bug.
Comment created by stof:
the alias should be prepended to the field before adding the sort in https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/QueryBuilder.php#L1101
Issue was closed with resolution "Fixed"