Affects Version/s: Git Master
Fix Version/s: None
Security Level: All
Environment:PHP 5.3 with SQLite 3 and PHP 5.4 with MySQL 5.5
UnitOfWork computes the change set on updated but not-persisted entities.
How to reproduce:
1. Suppose I have 2 entities of class Node stored on the database of choices.
2. Load the entities via the respective repository (to ensure that the unit of work manages them).
3. Update something on both entities.
4. Only store one of them.
Any changes on the entity which is not persisted must not be stored in the database.
The changes are saved.
Use the example:
1. Clone the demo app from firstname.lastname@example.org:shiroyuki/trphp13-demo.git.
2. Run the preparation commands to create the database (one DB called "trphp13"), schema (one table called "product") and load fixtures (3 entities).
3. Run app/console sandbox:case0 to recreate the bug.
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.