Skip to content

Loading…

DDC-187: JOIN fails with inherited entities #2532

Closed
doctrinebot opened this Issue · 8 comments

1 participant

@doctrinebot

Jira issue originally created by user nicokaiser:

"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

@doctrinebot

Comment created by nicokaiser:

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

@doctrinebot

Comment created by romanb:

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

@doctrinebot

Comment created by romanb:

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

@doctrinebot

Comment created by nicokaiser:

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

@doctrinebot

Comment created by nicokaiser:

Here are the classes and example code:

http://pastie.org/private/ljkiowarvm9trhdyug903q

@doctrinebot

Comment created by romanb:

Successfully reproduced in our test suite and working on it.

@doctrinebot

Comment created by romanb:

Should be fixed now. Thanks for reporting.

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.0-ALPHA4 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.