/** * {@inheritDoc} */ public function create(CommentInterface $comment) { $this->commentBlamer->blame($comment); if ($this->spamDetection->isSpam($comment)) { return false; } $this->commentManager->addComment($comment); return true; }
public function spamCheck(CommentPersistEvent $event) { $comment = $event->getComment(); if ($this->spamDetector->isSpam($comment)) { if (null !== $this->logger) { $this->logger->info('Comment is marked as spam from detector, aborting persistence.'); } $event->abortPersistence(); } }