コード例 #1
0
 /**
  * Adds the given new news object to the news repository
  *
  * @param \Lelesys\Plugin\News\Domain\Model\News $newNews A new news to add
  * @param array $media The media
  * @param array $file The file
  * @param array $tags The tag
  * @param array $relatedLink News related links
  * @return void
  */
 public function createAction(\Lelesys\Plugin\News\Domain\Model\News $newNews, $media, $file, $relatedLink, $tags)
 {
     $packageKey = $this->settings['flashMessage']['packageKey'];
     try {
         $this->newsService->create($newNews, $media, $file, $relatedLink, $tags);
         $header = 'Created a new news.';
         $message = $this->translator->translateById('lelesys.plugin.news.add.news', array(), NULL, NULL, 'Main', $packageKey);
         $this->addFlashMessage($message, $header, \TYPO3\Flow\Error\Message::SEVERITY_OK);
         $this->redirect('index');
     } catch (Lelesys\Plugin\News\Domain\Service\Exception $exception) {
         $header = 'Cannot create news at this time!!.';
         $message = $this->translator->translateById('lelesys.plugin.news.cannot.add', array(), NULL, NULL, 'Main', $packageKey);
         $this->addFlashMessage($message, $header, \TYPO3\Flow\Error\Message::SEVERITY_ERROR);
     }
 }