[DDC-187] JOIN fails with inherited entities Created: 02/Dec/09  Updated: 03/Dec/09  Resolved: 03/Dec/09

Status: Closed
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.0-ALPHA3
Fix Version/s: 2.0-ALPHA4
Security Level: All

Type: Bug Priority: Critical
Reporter: Nico Kaiser Assignee: Roman S. Borschel
Resolution: Fixed Votes: 0
Labels: None


"Entity\User\AbstractUser" is a base entity for user records, "Entity\User\Person" extends AbstractUser (Single Table inheritance in this case).
The "Setting" property is a OneToOne relation with another entity.

Now when I call this DQL:
SELECT u, t FROM Entity\User\AbstractUser u LEFT JOIN u.Setting t

The ObjectHydrator fails in line 276 ("if ( ! $relation->isOneToOne()) {"...) with "PHP Fatal error: Call to a member function isOneToOne() on a non-object in .../lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php".

It works when using the sub class for the query:
SELECT u, t FROM Entity\User\Person u LEFT JOIN u.Setting t

Comment by Nico Kaiser [ 02/Dec/09 ]

It seems like ObjectHydrator::_hydrateRow tries to find a _ce entry for AbstractUser (but _ce only holds entries for Person)...

Comment by Roman S. Borschel [ 02/Dec/09 ]

Does Setting use inheritance also? TopnewsSetting extends Setting? If so which inheritance type?

Comment by Roman S. Borschel [ 02/Dec/09 ]

Can we see the classes and their mappings? AbstractUser, User, Setting and TopnewsSetting. Then I can set up a test to reproduce it. Thanks!

Comment by Nico Kaiser [ 02/Dec/09 ]

Oh no I forgot to change TopnewsSetting to Setting in this report, there is no inheritance, just copy & paste bug.

Comment by Nico Kaiser [ 03/Dec/09 ]

Here are the classes and example code:


Comment by Roman S. Borschel [ 03/Dec/09 ]

Successfully reproduced in our test suite and working on it.

Comment by Roman S. Borschel [ 03/Dec/09 ]

Should be fixed now. Thanks for reporting.

Generated at Mon Nov 30 08:47:53 EST 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.