-
-
Notifications
You must be signed in to change notification settings - Fork 62
Closed
Description
HasMany::set() should be optimized to avoid unnecessary removes & adds. From the long term, we could also delegate some handling via storage, but for now only the PHP runtime comparison could be utilized.
orm/src/Relationships/HasMany.php
Lines 230 to 236 in 97e9e89
| foreach ($this->getCollection() as $entity) { | |
| $this->remove($entity); | |
| } | |
| foreach ($data as $entity) { | |
| $this->add($entity); | |
| } |
We should fetch the data, count the diff and add and remove only the needed.