mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-187: JOIN fails with inherited entities #230
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Dec 2, 2009).
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 tThe 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 commented on GitHub (Dec 2, 2009):
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 commented on GitHub (Dec 2, 2009):
Comment created by romanb:
Does Setting use inheritance also? TopnewsSetting extends Setting? If so which inheritance type?
@doctrinebot commented on GitHub (Dec 2, 2009):
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 commented on GitHub (Dec 2, 2009):
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 commented on GitHub (Dec 3, 2009):
Comment created by nicokaiser:
Here are the classes and example code:
http://pastie.org/private/ljkiowarvm9trhdyug903q
@doctrinebot commented on GitHub (Dec 3, 2009):
Comment created by romanb:
Successfully reproduced in our test suite and working on it.
@doctrinebot commented on GitHub (Dec 3, 2009):
Comment created by romanb:
Should be fixed now. Thanks for reporting.
@doctrinebot commented on GitHub (Dec 3, 2009):
Issue was closed with resolution "Fixed"