Given a simple Joined Table Inheritance like following:
Will produce broken SQL:
(please note the duplicate `ON` in the SQL)
That is caused because of the SQL walker producing the JTI filter with already the `ON` clause in it.
That happens because the JTI join conditions are added in https://github.com/doctrine/doctrine2/blob/2.4.0-BETA2/lib/Doctrine/ORM/Query/SqlWalker.php#L823-L825 (`walkRangeVariableDeclaration`), while the additional defined `WITH` conditions are considered in `walkJoinAssociationDeclaration` later on.
Added a test case and fix at https://github.com/doctrine/doctrine2/pull/668