mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-261: Object population from OneToOne association #324
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 (Jan 18, 2010).
Jira issue originally created by user fabrizzio:
Bugreport cfr. http://groups.google.com/group/doctrine-user/browse_thread/thread/51f5c14377c40e3b
I have a OneToOne relationship defined between a Page and a PageTemplate entity:
When I try to fetch the Page and it's fully populated associated PageTemplate from the database, I get differect results using different Hydration modes (HYDRATE_OBJECT & HYDRATE_ARRAY):
When using:
... I get the following:
On the other hand when I'm using HYDRATE_ARRAY:
.. I get the following:
So fetch the object using HYDRATE_ARRAY returns the data I asked for, HYDRATE_OBJECT doesn't (returns a null object)
@doctrinebot commented on GitHub (Jan 18, 2010):
@doctrinebot commented on GitHub (Jan 18, 2010):
Comment created by romanb:
Tried to reproduce it without success. See the attached testcase. Using latest code from trunk.
Please let us know what needs to be done in that testcase to reproduce your problem. Or provide your own testcase if you have one.
Thanks!
@doctrinebot commented on GitHub (Jan 18, 2010):
Comment created by fabrizzio:
I found the problem in my code. In the Page object constructor I composed an empty PageTemplate instance (null object):
This overrides the PageTemplate object that should be loaded.
Shouldn't the PageTemplate data be loaded after the Page constructor has been executed so it would overrule that one?
Thank you for your time!
@doctrinebot commented on GitHub (Jan 18, 2010):
Comment created by romanb:
You are right, this is not correct. While this could be fixed in isolation I think it is better to fix it implicity by DDC-79 (not calling the constructor on reconstitution of persistent objects).
@doctrinebot commented on GitHub (Feb 10, 2010):
Comment created by romanb:
This should now work without problems due to DDC-79.
@doctrinebot commented on GitHub (Feb 10, 2010):
Issue was closed with resolution "Fixed"
@doctrinebot commented on GitHub (Dec 13, 2015):
Imported 1 attachments from Jira into https://gist.github.com/abb29d35fca7c9483666