Doctrine 1

Incorrect query for inherited many-to-many relation