Skip to content

Commit

Permalink
Crop cache updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasHermanek committed Nov 4, 2024
1 parent 63ea494 commit ddf38fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/Domain/Image/Crop/CropCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -60,18 +59,18 @@ public function get(ImageFile $image, ImageCropDto $imageCrop): string
public function removeCache(ImageFile $image): void
{
$this->removeCacheByOriginFilePath(
$image->getExtSystem(),
$image->getExtSystem()->getSlug(),
$image->getAssetAttributes()->getFilePath()
);
}

/**
* @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)
);
Expand Down
2 changes: 1 addition & 1 deletion src/Event/Subscriber/AssetFileDeleteEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}
Expand Down

0 comments on commit ddf38fa

Please sign in to comment.