/** * Adds the given new comment object to the comment repository * * @Flow\Validate(type="\Lelesys\Captcha\Validators\CaptchaValidator", value="$captcha") * @Flow\Validate(type="NotEmpty", value="$captcha") * @param \Lelesys\Plugin\News\Domain\Model\Comment $newComment A new comment to add * @param \Lelesys\Plugin\News\Domain\Model\News $news * @param string $captcha Captcha for comment * @return void */ public function createAction(\Lelesys\Plugin\News\Domain\Model\Comment $newComment, \Lelesys\Plugin\News\Domain\Model\News $news, $captcha = NULL) { try { $this->commentService->create($newComment, $news); $array = array("news" => $news); $this->addFlashMessage($this->translator->translateById('lelesys.plugin.news.comment.created', array(), NULL, NULL, 'Main', $this->settings['flashMessage']['packageKey'])); $this->redirect("show", "News", "Lelesys.Plugin.News", $array); } 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); } }