mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3005: Events::postLoad fires without filled associations #3736
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 (Mar 2, 2014).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user strate:
When we load entities throw one dql query like this:
In event subscriber, subscribed to postLoad event for instances of Entity property "link" of entity does not contains fetched in same query joined entity, and does not contains proxy object.
Tell me if failing test case needed.
@doctrinebot commented on GitHub (Mar 2, 2014):
@doctrinebot commented on GitHub (Mar 2, 2014):
Comment created by @ocramius:
The
postLoadevent is fired without warranty that association entities/proxies will be set:http://docs.doctrine-project.org/en/latest/reference/events.html#lifecycle-events
@doctrinebot commented on GitHub (Mar 3, 2014):
Comment created by strate:
But why? This shounds like involuntary restriction, and I think it can be fixed. Will my PR with fix accepted, or collaborators don't want to change this behaviour?
@doctrinebot commented on GitHub (Mar 3, 2014):
Comment created by @ocramius:
[~strate] triggering
postLoadin the correct moment in time (when all dependencies are loaded) requires a lot of additional complexity to be inserted in various locations of the ORM.Since
postLoadis supposed to be used like**wakeupand in general for simple tasks, this kind of refactoring/rewrite would be an overkill.@doctrinebot commented on GitHub (Mar 4, 2014):
Comment created by strate:
And I forced to repeat the question: will PR with fix accepted or not?
@doctrinebot commented on GitHub (Mar 4, 2014):
Comment created by @ocramius:
{quote}Sounds like "It is very hard to implement, and no one want to do this"{quote}
Not really, the main problem here is performance, since hydration would have to be completely redesigned.
Yes, "too hard" is a good reason for something that is an edge case.
{quote}And I forced to repeat the question: will PR with fix accepted or not?{quote}
Sure thing! Just needs to avoid a massive rewrite though.
@doctrinebot commented on GitHub (Mar 4, 2014):
Comment created by @ocramius:
To give you some hints,
Doctrine\ORM\Events::postLoadis triggered in15432fc55f/lib/Doctrine/ORM/UnitOfWork.php (L2788), andDoctrine\ORM\UnitOfWork#createEntity()is used by all the various hydrators internally.To ensure that
Doctrine\ORM\Events::postLoadis triggered after an entity is fully loaded, the various hydrators must trigger the events after being sure that all data has been set, and that the entity is "ready" for use. That's some copy-paste work :\@doctrinebot commented on GitHub (Mar 4, 2014):
Comment created by strate:
I think the entry point is here:
15432fc55f/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php (L140),so, copy-paste work is not needed )
@doctrinebot commented on GitHub (Apr 5, 2014):
Comment created by strate:
PR is ready: https://github.com/doctrine/doctrine2/pull/1001
@doctrinebot commented on GitHub (Oct 19, 2014):
Comment created by @doctrinebot:
A related Github Pull-Request [GH-1001] was assigned:
https://github.com/doctrine/doctrine2/pull/1001
@doctrinebot commented on GitHub (Oct 19, 2014):
Comment created by @doctrinebot:
A related Github Pull-Request [GH-1001] was unassigned:
https://github.com/doctrine/doctrine2/pull/1001
@doctrinebot commented on GitHub (Jan 12, 2015):
Comment created by @doctrinebot:
A related Github Pull-Request [GH-1001] was closed:
https://github.com/doctrine/doctrine2/pull/1001
@doctrinebot commented on GitHub (Jan 12, 2015):
Comment created by @ocramius:
Handled in DDC-3070
@doctrinebot commented on GitHub (Jan 12, 2015):
Issue was closed with resolution "Fixed"