Doctrine 2 - ORM

[GH-457] Fixes case when an entity has a relationship with a class with joined inheritance