Jira issue originally created by user Ceiu:
This regression was introduced in 2.4.2 with the addition of the "rootAlias" stuff. Basically, the hard-coded addition of the rootAlias + "." prevents any Criteria object from referencing any field that isn't on the first table selected.
// Assume $repo is a valid EntityRepository and $value is some scalar value.
$qb = $repo->createQueryBuilder('T1')->join('T1.field', 'T2');
$criteria = new Comparison('T2.field2', Comparison::EQ, $value);
$dql = $qb->getDQL();
$dql is now (roughly) equal to:
SELECT T1 FROM T1 JOIN T1.field T2 WHERE T1.T2.field2 =
Evaluating this causes QueryExceptions to be thrown; usually something along the lines of "Expected Doctrine\ORM\Query\Lexer::, got '.'"
There's a similar issue involving ordering by a related field for the same reason.
Comment created by @ocramius:
Fixed in DDC-3436
Issue was closed with resolution "Fixed"