diff --git a/CHANGELOG.md b/CHANGELOG.md index 25ef7c2..7979a53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.9.1](https://github.com/anzusystems/core-dam-bundle/compare/1.9.0...1.9.1) (2024-05-09) + +### Fixes +* update licence collection in `AssetLicenceGroup` update + ## [1.9.0](https://github.com/anzusystems/core-dam-bundle/compare/1.8.2...1.9.0) (2024-04-25) ### Features diff --git a/src/Domain/AssetLicenceGroup/AssetLicenceGroupManager.php b/src/Domain/AssetLicenceGroup/AssetLicenceGroupManager.php index a5c7595..49b2f20 100644 --- a/src/Domain/AssetLicenceGroup/AssetLicenceGroupManager.php +++ b/src/Domain/AssetLicenceGroup/AssetLicenceGroupManager.php @@ -5,7 +5,10 @@ namespace AnzuSystems\CoreDamBundle\Domain\AssetLicenceGroup; use AnzuSystems\CommonBundle\Domain\AbstractManager; +use AnzuSystems\CoreDamBundle\Entity\AssetLicence; use AnzuSystems\CoreDamBundle\Entity\AssetLicenceGroup; +use AnzuSystems\CoreDamBundle\Entity\DamUser; +use Doctrine\Common\Collections\Collection; final class AssetLicenceGroupManager extends AbstractManager { @@ -26,7 +29,19 @@ public function update(AssetLicenceGroup $assetLicenceGroup, AssetLicenceGroup $ ; $this->colUpdate( oldCollection: $assetLicenceGroup->getLicences(), - newCollection: $newAssetLicenceGroup->getLicences() + newCollection: $newAssetLicenceGroup->getLicences(), + addElementFn: function (Collection $oldCollection, AssetLicence $licence) use ($assetLicenceGroup): bool { + $licence->getGroups()->add($assetLicenceGroup); + $oldCollection->add($licence); + + return true; + }, + removeElementFn: function (Collection $oldCollection, AssetLicence $licence) use ($assetLicenceGroup): bool { + $licence->getGroups()->removeElement($assetLicenceGroup); + $oldCollection->removeElement($licence); + + return true; + } ); $this->flush($flush);