/** * @param array $formData * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ protected function executePost(array $formData) { return $this->actionHelper->handleCreatePostAction(function () use($formData) { $this->galleryFormValidation->validate($formData); $formData['user_id'] = $this->user->getUserId(); return $this->galleryModel->save($formData); }); }
/** * @param array $formData * @param int $galleryId * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ protected function executePost(array $formData, $galleryId) { return $this->actionHelper->handleEditPostAction(function () use($formData, $galleryId) { $this->galleryFormValidation->setUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId))->validate($formData); $formData['user_id'] = $this->user->getUserId(); return $this->galleryModel->save($formData, $galleryId); }); }
/** * @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); }); }