Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.0-ALPHA3
-
Fix Version/s: 2.0-ALPHA4
-
Component/s: ORM
-
Security Level: All
-
Labels:None
Description
Step to reproduce :
1) create Two entity with bidirectionnal oneToMany association.
ex :
Client (id, name | emails)
Email(id, email, client_id | clients)
Email is the owning side.
2) Do a query using both entity
$qb->select('client', 'emails')
->from('Client', 'client')
->leftJoin('client.emails', 'emails')
->where(...);
$query = $qb->getQuery();
$client = $query->getSingleResult();
$em->flush();
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.
Thank you
Activity
| 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 ] |