mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Within phase of completing hydratation is PostLoad callback launched on inappropriate entity #6003
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 @cejen on GitHub (Jun 28, 2018).
Originally assigned to: @Ocramius on GitHub.
Bug Report
Summary
When entity hydratation is completed on child entity within hydratation of parent entity, PostLoad callback (and probably all callbacks) of parent entity is launched. Parent entity is not completely hydrated at this moment.
Current behavior
Quoted in bug summary
How to reproduce
Model:
Issued DQL statement:
Query result is hydrated from result set in this steps (in class
\Doctrine\ORM\Internal\Hydration\ObjectHydrator):EnityAis hydratedpropBis hydratedpropCis hydrated. Because propertypropEof classEntityCis related to mapped superclass, extra SQL select is issued to load data of propertypropE(mapped superclass = cannot be proxied). When entityEntityEis completely hydrated then methodObjectHydrator::cleanupis launched. Within this method is launched$this->_uow->hydrationComplete(). It causes invoking methodEntityA::postLoad, but entity is still incomplete at this moment (propertypropDwasn't already hydrated).Expected behavior
Hydratation cleanup step 3 must be performed only for entity
EntityEused to setup propertypropE. Hydratation cleanup step for entityEntityAmust be performed after all properties are hydrated.@Ocramius commented on GitHub (Jun 28, 2018):
Please verify if this is still valid on
2.6.x: unless there is a security issue, ORM2.5.xwon't be touched anymore.@cejen commented on GitHub (Jun 28, 2018):
We cannot use version
2.6.xbecause our customer use PHP 5.6. If version2.5.xwon't be touched we try to find any workaround. Delete this issue please. Thanks for your response.@Ocramius commented on GitHub (Jun 28, 2018):
Please see https://secure.php.net/supported-versions.php - PHP 5.x is being retired this year, so please make pressure on your client to update to something current.
Closing here meanwhile.