Step to reproduce :
1) create Two entity with bidirectionnal oneToMany association.
Client (id, name | emails)
Email(id, email, client_id | clients)
Email is the owning side.
2) Do a query using both entity
$query = $qb->getQuery();
$client = $query->getSingleResult();
3) If you set listener on onUpdate event, you will notice that the Email entity is updated.
I looked deep into UnitOfWork and ObjectHydrator and I see that the originalEntityData (used to calculate modified data before update) is saved before the manyToMany relation is set by a call to hydrateAdd (ObjectHydrator line 322)
In my previously bug report :
DDC-139, I tought I had to check if an entity have changed in the onUpdate. Now, I see that entity are wrongly updated.
I can provide a more detailled test case if you need more informations.
|Field||Original Value||New Value|
|Fix Version/s||2.0-ALPHA4 [ 10036 ]|
|Priority||Major [ 3 ]||Minor [ 4 ]|
|Status||Open [ 1 ]||Resolved [ 5 ]|
|Resolution||Fixed [ 1 ]|
|Workflow||jira [ 10403 ]||jira-feedback [ 14167 ]|
|Workflow||jira-feedback [ 14167 ]||jira-feedback2 [ 16031 ]|
|Workflow||jira-feedback2 [ 16031 ]||jira-feedback3 [ 18284 ]|