Open MassiveHiggsField opened 6 years ago
Same problem!! Since 2018? :(
@DamienHarper are you aware of this? i was checking your code at https://github.com/DamienHarper/auditor/blob/6843e885518a1d8b61868fc0ba36a257a28ad828/src/Provider/Doctrine/Auditing/Transaction/TransactionHydrator.php to create a logger for a legacy migration with tables that have composite keys everywhere
Support Question
So, i've been trying to track changes to an associated relation in an onflush listener.
I'm using this code to check for changes:
But the results seem to be inconsistent or not usable. Here are my findings:
Scenario: My associated list has three items in it
Case 1: What happens if i remove one item from the association?
This seems a litte bit weird, i would expect getScheduledCollectionDeletions would have the entry, but fine, i can work with this (i've also tried removing two items, which also worked and getDeleteDiff had two entries).
Case 2: What happens if i add one item to the association?
This would be as expected (i've also tried adding two items, which also worked and getInsertDiff had two entries)
Case 3: What happens if i add one item and remove one item from the association?
This cannot be right. There seems to be no way to find out that this list has been changed.
Case 4: What happens if i add two items and remove one item from the association?
Once again, this cant be right. Only one addition is tracked.
Case 5: What happens if i add one item and remove two items from the association?
Once again, doesnt seem to be right. Only one deletion is tracked.
So, i cant figure out how to track all changes to the associated list. Any help appreciated? Maybe this is even a bug. It seems to me the getScheduledCollectionUpdates calculates changes by comparing the list length before and after, not really comparing the changes to the list.