-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store PersistentCollection changes in entity change set as array #9939
base: 3.0.x
Are you sure you want to change the base?
Store PersistentCollection changes in entity change set as array #9939
Conversation
lib/Doctrine/ORM/UnitOfWork.php
Outdated
@@ -683,7 +683,7 @@ public function computeChangeSet(ClassMetadata $class, object $entity): void | |||
} | |||
|
|||
$this->collectionDeletions[$coid] = $orgValue; | |||
$changeSet[$propName] = $orgValue; // Signal changeset, to-many assocs will be ignored. | |||
$changeSet[$propName] = [$orgValue, $actualData]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this change will leave dead code somewhere that handled the non-array value of $changeSet[$propName] = $orgValue;
, but I haven't found any.
40216fc
to
60a407a
Compare
702daeb
to
0942222
Compare
0942222
to
8d192f4
Compare
Can we prepare this change on 2.x somehow, e.g. by allowing apps to opt-in to it? |
The property $entityChangeSets of UnitOfWork stores entity changes as an array of two items for each property changed. Before this change, when an entity with a property holding a Collection was changed, $entityChangeSets stored only the old Collection.
ec9f131
754fde3
to
211347d
Compare
211347d
to
f0df183
Compare
I forgot about this PR.
I cannot think a way to do that 😞 |
The property
$entityChangeSets
of UnitOfWork stores entity changes as an array of two items for each property changed.orm/lib/Doctrine/ORM/UnitOfWork.php
Lines 143 to 149 in a3a8caa
But for
Collection
it has another behaviour as pointed out in #8955 and changed the phpdoc in #8959.That was added in 65bbdc3.
This PR modifies that case storing an
array
instead of thePersistentCollection
, this will allowPreUpdateEventArgs
to extend fromPreUpdateEventArgs
ofdoctrine/persistence
.I'm not sure if this is the right fix, but apparently the test added in the original commit passes with this change.