public function validateRemoval(AssetInterface $asset) { if ($asset instanceof ImageVariant) { return; } if ($this->isInUse($asset)) { throw new AssetServiceException('Asset could not be deleted, because it is still in use.', 1462196420); } }
/** * Remove an asset while first validating if the object can be removed or * if removal is blocked because the asset is still in use. * * @param AssetInterface $object * @return void */ public function remove($object) { $this->assetService->validateRemoval($object); parent::remove($object); $this->assetService->emitAssetRemoved($object); }