Skip to content

HasMany::set() optimization #511

@hrach

Description

@hrach

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.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions