Doctrine

TIL that Doctrine 2 doesn't support LIMITs within subqueries which can be frustrating. In my case, I wanted to LEFT JOIN on a table using a subquery with a single result - something like this:

$dqb->from('MyAppBundle:Foo', 'foo')
    ->leftJoin('foo.bar', 'bar', 'WITH', 'bar = (SELECT b FROM MyAppBundle:Bar b WHERE b.foo = foo AND b.published_date >= :now ORDER BY t.startDate LIMIT 1)');

But Doctrine kept throwing this error: