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
Doctrine 2.5 - Entity Update Bug #7035
Comments
Changes to object properties are detected by reference so if the object (instance) does not change, it's deemed to be same. See description fo DateTime, it applies to objects in general: https://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/cookbook/working-with-datetime.html#datetime-changes-are-detected-by-reference |
I think littering in entities is doubtful. Maybe it's better to use a setting for example:
In my case it will be easier to extend method persist, check properties of the entity on the availability of necessary objects and use clone there where it is should be. |
"littering in entities"? |
Sorry for my beginner's English. I mean it's trash into entities. |
No, it's just good practice to avoid sharing referentially kept mutable state by de-referencing via |
Thank you very much! |
I have the entity (this is simple example):
My RecordTranslationCollection extends \Doctrine\Common\Collections\ArrayCollection
And my ContentContext_RecordTranslationCollection type looks like this:
Ok, it all works when you create and save a new entity! But there is a problem when updating.
When I get the entity Record from the database to update the collection of translations, for example:
And my new collection does not save.
Doctrine does not understand that the object RecordTranslationCollection has changed.
And the method convertToDatabaseValue is not called.
If you use a spike, for example:
The entity will be saved correctly. So doctrine does not see the changes inside the object, but only see the object itself.
The text was updated successfully, but these errors were encountered: