public function vote(
        CommentInterface $comment,
        $authorToken,
        $type
    ) {
        /**
         * @var VoteInterface $vote
         */
        $vote = $this
            ->commentVoteObjectDirector
            ->findOneBy([
                'authorToken' => $authorToken,
                'comment' => $comment,
            ]);

        $edited = true;

        if (!($vote instanceof VoteInterface)) {
            $vote = $this
                ->commentVoteObjectDirector
                ->create()
                ->setAuthorToken($authorToken)
                ->setComment($comment);

            $edited = false;
        }

        $vote->setType($type);

        $this
            ->commentVoteObjectDirector
            ->save($vote);

        $this
            ->commentEventDispatcher
            ->dispatchCommentOnVotedEvent($comment, $vote, $edited);

        return $vote;
    }
public function vote(
        CommentInterface $comment,
        $authorToken,
        $type
    ) {
        /**
         * @var VoteInterface $vote
         */
        $vote = $this
            ->commentVoteObjectDirector
            ->findOneBy([
                'authorToken' => $authorToken,
                'comment' => $comment,
            ]);

        $edited = true;

        if (!($vote instanceof VoteInterface)) {
            $vote = $this
                ->commentVoteObjectDirector
                ->create()
                ->setAuthorToken($authorToken)
                ->setComment($comment);

            $edited = false;
        }

        $vote->setType($type);

        $this
            ->commentVoteObjectDirector
            ->save($vote);

        $this
            ->commentEventDispatcher
            ->dispatchCommentOnVotedEvent($comment, $vote, $edited);

        return $vote;
    }
public function vote ( CommentInterface $ comment , $ authorToken , $ type ) { /**
         * @var VoteInterface $vote
         */ $ vote = $ this -> commentVoteObjectDirector -> findOneBy ( [ 'authorToken' => $ authorToken , 'comment' => $ comment , ] ) ; $ edited = true ; if ( ! ( $ vote instanceof VoteInterface ) ) { $ vote = $ this -> commentVoteObjectDirector -> create ( ) -> setAuthorToken ( $ authorToken ) -> setComment ( $ comment ) ; $ edited = false ; } $ vote -> setType ( $ type ) ; $ this -> commentVoteObjectDirector -> save ( $ vote ) ; $ this -> commentEventDispatcher -> dispatchCommentOnVotedEvent ( $ comment , $ vote , $ edited ) ; return $ vote ; }
Vote action.

@param CommentInterface $comment     Comment
@param string           $authorToken Author token
@param bool             $type        Vote type

@return VoteInterface Vote
Vote action .