protected function getDiaporamaImage(DiaporamaImageEvent $event)
 {
     $model = DiaporamaImageQuery::create()->findPk($event->getId());
     if (null === $model) {
         throw new \RuntimeException(sprintf("The 'diaporama_image' id '%d' doesn't exist", $event->getId()));
     }
     return $model;
 }
 /**
  * Creates the delete event with the provided form data
  */
 protected function getDeleteEvent()
 {
     $event = new DiaporamaImageEvent();
     $event->setId($this->getRequest()->request->get("diaporama_image_id"));
     return $event;
 }
 public function deleteImageAction($imageId)
 {
     // Check current user authorization
     if (null !== ($response = $this->checkAuth($this->resourceCode, $this->getModuleCode(), AccessManager::DELETE))) {
         return $response;
     }
     try {
         $diaporama_image = DiaporamaImageQuery::create()->findPk($imageId);
         $event = new DiaporamaImageEvent($imageId);
         $event->setId($imageId);
         $this->dispatch($this->deleteEventIdentifier, $event);
         $this->performAdditionalDeleteAction($event);
         return $this->generateRedirect($diaporama_image->getRedirectionUrl());
     } catch (\Exception $e) {
         return $this->renderAfterDeleteError($e);
     }
 }