/** * @param string $action * * @return mixed */ public function execute($action = '') { return $this->actionHelper->handleDeleteAction($action, function (array $items) { foreach ($items as $item) { $pictures = $this->pictureRepository->getPicturesByGalleryId($item); foreach ($pictures as $row) { $this->galleryHelpers->removePicture($row['file']); } $this->galleryCache->getCacheDriver()->delete(Gallery\Cache::CACHE_ID . $item); if ($this->uriAliasManager) { $this->uriAliasManager->deleteUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $item)); } $this->deletePictureAliases($item); } return $this->galleryModel->delete($items); }); }