diff --git a/src/Domain/Image/Crop/CropCache.php b/src/Domain/Image/Crop/CropCache.php index 8e726154..269a5054 100644 --- a/src/Domain/Image/Crop/CropCache.php +++ b/src/Domain/Image/Crop/CropCache.php @@ -4,7 +4,6 @@ namespace AnzuSystems\CoreDamBundle\Domain\Image\Crop; -use AnzuSystems\CoreDamBundle\Entity\ExtSystem; use AnzuSystems\CoreDamBundle\Entity\ImageFile; use AnzuSystems\CoreDamBundle\FileSystem\FileSystemProvider; use AnzuSystems\CoreDamBundle\FileSystem\NameGenerator\NameGenerator; @@ -60,7 +59,7 @@ public function get(ImageFile $image, ImageCropDto $imageCrop): string public function removeCache(ImageFile $image): void { $this->removeCacheByOriginFilePath( - $image->getExtSystem(), + $image->getExtSystem()->getSlug(), $image->getAssetAttributes()->getFilePath() ); } @@ -68,10 +67,10 @@ public function removeCache(ImageFile $image): void /** * @throws FilesystemException */ - public function removeCacheByOriginFilePath(ExtSystem $extSystem, string $path): void + public function removeCacheByOriginFilePath(string $extSystemSlug, string $path): void { $this->fileSystemProvider - ->getCropFilesystemByExtSystemSlug($extSystem->getSlug()) + ->getCropFilesystemByExtSystemSlug($extSystemSlug) ->deleteDirectory( $this->getCacheDir($path) ); diff --git a/src/Event/Subscriber/AssetFileDeleteEventSubscriber.php b/src/Event/Subscriber/AssetFileDeleteEventSubscriber.php index 64c9360c..c741e0c9 100644 --- a/src/Event/Subscriber/AssetFileDeleteEventSubscriber.php +++ b/src/Event/Subscriber/AssetFileDeleteEventSubscriber.php @@ -36,7 +36,7 @@ public function deleteAssetFile(AssetFileDeleteEvent $event): void if ($event->getType()->is(AssetType::Image)) { if (false === empty($event->getAssetFile()->getFilePath())) { $this->cropCache->removeCacheByOriginFilePath( - $event->getAssetFile()->getExtSystem(), + $event->getAssetFile()->getExtSystem()->getSlug(), $event->getAssetFile()->getFilePath() ); }