mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Doctrine_Collection forgets it is part of a reference when serialized #6525
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 @spaanse on GitHub (Aug 26, 2020).
Short description:
A Doctrine_Collection does not remember it's
_referenceFieldunder serialisation. This means that under serialisation/unseralisation any new members don't get their reference updated.Let there be two database tables
FooandBar, where there is a one-to-many relation between them:Then when the following code is run the output is null instead of a Foo object:
This is because the Doctrine_Collection $foo->Bar has cleared it's
_referenceFieldunder serialisation. Then after being unserialised it is just a normal Doctrine_Collection, so does not automatically set $bar->Foo when adding the object.@spaanse commented on GitHub (Aug 26, 2020):
Apparantly we use an old version of Doctrine, so this might not be a problem anymore