doctrine/doctrine2 — pull request #1212 by kieljohn (2014-12-06 14:51:25+00:00)
Title: [DDC-3108] Fix regression where join aliases were no longer accessible in Criteria expressions

The solution to issue DDC-2764 was to blanket prefix all the fields with the root alias. The result was then impossible to use fields from multiple FROM tables or a JOIN.

This patch injects all available aliases into the comparison, if a field uses one of the aliases it will pass without modification. If it is an unknown alias it will prefix the first rootAlias listed using the same functionality as the deprecated getRootAlias() function.

Also improves the ORDER BY on Criteria expressions, again introduced by [DDC-2764] using the above functionality, this was out of scope of bug [DDC-3108].

Added unit tests to test new functionality.