コード例 #1
0
 /**
  * Removes the asset of news
  *
  * @param string $newsId
  * @param \TYPO3\Media\Domain\Model\Document $fileId
  * @return void
  */
 public function removeRelatedFileAction($newsId, $fileId)
 {
     try {
         $news = $this->newsService->findById($newsId);
         $this->newsService->removeRelatedFile($fileId, $news);
         echo json_encode(1);
         exit;
     } catch (Lelesys\Plugin\News\Domain\Service\Exception $exception) {
         $packageKey = $this->settings['flashMessage']['packageKey'];
         $header = 'Sorry, error occured. Please try again later.';
         $message = $this->translator->translateById('lelesys.plugin.news.try.again', array(), NULL, NULL, 'Main', $packageKey);
         $this->addFlashMessage($message, $header, \TYPO3\Flow\Error\Message::SEVERITY_ERROR);
     }
 }