Jira issue originally created by user shiroyuki:
UnitOfWork computes the change set on updated but not-persisted entities.
How to reproduce:
Any changes on the entity which is not persisted must not be stored in the database.
The changes are saved.
Use the example:
I traced the bug down to computeChangeSet and it seems that even though the entity is not scheduled for dirty checks, the unit of work still computes the change set of the problematic entity. From the provided example, the node named "Node 2" should not be updated to "B" when the CaseZero command is executed.
Comment created by @ocramius:
[~shiroyuki] we are not going to checkout your project for this. Please make a small example that uses ONLY the ORM, with no other involved frameworks.
You should be able to do that in a single php script that includes:
1) the involved entities
2) an initialization of the ORM
3) the functional example
we can then convert that into a unit test once it has been verified.
Comment created by @guilhermeblanco:
This should be related to change tracking policy.
Doctrine uses IMPLICIT change tracking policy by default, applying an algorithm called persist-by-reachability.
To fix your issue, you need to modify your change tracking to DEFERRED_EXPLICIT or NOTIFY.
Here is a more detailed explanation:
So the change you need to do is: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/change-tracking-policies.html
It's an issue of misunderstanding change tracking policies.
Issue was closed with resolution "Invalid"
Comment created by shiroyuki:
Thank you. :D