/** * {@inheritDoc} */ public function create(CommentInterface $comment) { $this->commentBlamer->blame($comment); if ($this->spamDetection->isSpam($comment)) { return false; } $this->commentManager->addComment($comment); return true; }
/** * {@inheritDoc} */ public function addComment(CommentInterface $comment, CommentInterface $parent = null) { if (!$this->threadAcl->canView($comment->getThread())) { throw new AccessDeniedException(); } if (!$this->commentAcl->canReply($parent)) { throw new AccessDeniedException(); } $this->realManager->addComment($comment, $parent); $this->commentAcl->setDefaultAcl($comment); }