protected function getDiaporama(DiaporamaEvent $event) { $model = DiaporamaQuery::create()->findPk($event->getId()); if (null === $model) { throw new \RuntimeException(sprintf("The 'diaporama' id '%d' doesn't exist", $event->getId())); } return $model; }
public function deleteAction() { // Check current user authorization if (null !== ($response = $this->checkAuth($this->resourceCode, $this->getModuleCode(), AccessManager::DELETE))) { return $response; } try { $form = $this->createForm('diaporama.delete'); $valform = $this->validateForm($form); $event = new DiaporamaEvent(); $event->setId($valform->getData()['diaporama_id']); $this->dispatch($this->deleteEventIdentifier, $event); $this->performAdditionalDeleteAction($event); return $this->generateSuccessRedirect($form); } catch (FormValidationException $e) { return $this->renderAfterDeleteError($e); } catch (\Exception $e) { return $this->renderAfterDeleteError($e); } }
/** * Creates the delete event with the provided form data */ protected function getDeleteEvent() { $event = new DiaporamaEvent(); $event->setId($this->getRequest()->request->get("diaporama_id")); return $event; }