-
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
UnitOfWork->originalEntityData is missing not-modified collections after computeChangeSet #9300
Comments
Its a very tricky issue and requires 2h+ of concentrated time, sorry we didnt get to it yet but i want to be thorough with it |
Entity id also goes missing. I addressed both of these issues in my PR quite some time ago. #7318 |
@supersmile2009 I don't think that's an issue or at least it's a separate issue since these are auto-generated fields and doctrine handles them just fine in the end. Whereas for collections, the mapping is broken after the first flush and it may result in very hard to detect bugs that puts data into inconsistent state. Sorry for bothering you once again @beberlei but I think this issue is hard to prevent from the developers perspective and the data are hard to recover when it actually occurs. |
Bug Report
Summary
UnitOfWork->computeChangeSet(ClassMetadata $class, $entity)
overrides the$this->originalEntityData[$oid]
by$actualData
constructed inside this class.Collections that were hydrated from the DB but not overridden (
$value instanceof PersistentCollection && $value->getOwner === $entity
) are skipped and not present in the$actualData
variable.This causes duplicate inserts and possibly other issues in case of subsequent flushes/computeChangeSet calls.
How to reproduce
See #9301
Expected behavior
All fields of entity should be present in $actualData (and therefore in originalEntityData).
The text was updated successfully, but these errors were encountered: