/** * Persists a vote. * * @param VoteInterface $vote * @param VotableCommentInterface $comment * @return void */ public function addVote(VoteInterface $vote, VotableCommentInterface $comment) { $vote->setComment($comment); $comment->setScore($comment->getScore() + $vote->getValue()); $this->dm->persist($comment); $this->dm->persist($vote); $this->dm->flush(); }