src/PHPDish/Bundle/PostBundle/Service/CommentManager.php
public function addVoter(CommentInterface $comment, UserInterface $user)
    {
        $comment->addVoter($user)
            ->addVoteCount();
        $this->entityManager->persist($comment);
        $this->entityManager->flush();

        //触发事件
        $this->eventDispatcher->dispatch(Events::COMMENT_VOTED,
            new VoteCommentEvent($comment->getPost(), $comment, $user)
        );
    }
public function addVoter(CommentInterface $comment, UserInterface $user)
    {
        $comment->addVoter($user)
            ->addVoteCount();
        $this->entityManager->persist($comment);
        $this->entityManager->flush();

        //触发事件
        $this->eventDispatcher->dispatch(Events::COMMENT_VOTED,
            new VoteCommentEvent($comment->getPost(), $comment, $user)
        );
    }
{@inheritdoc}