public function noticeMicropetitionCommented(Micropetitions\Comment $comment) { $micropetition = $comment->getPetition(); $target = ['id' => $micropetition->getId(), 'preview' => $this->preparePreview($comment->getCommentBody()), 'type' => $micropetition->getType(), 'label' => $micropetition->getType() === $micropetition::TYPE_QUORUM ? 'post' : 'petition']; if ($comment->getParentComment()->getUser()) { $target['comment_id'] = $comment->getId(); } $socialActivity = (new SocialActivity(SocialActivity::TYPE_FOLLOW_MICROPETITION_COMMENTED, $comment->getUser(), $micropetition->getGroup()))->setTarget($target); $this->em->persist($socialActivity); $this->em->flush($socialActivity); if ($comment->getParentComment()->getUser() && $comment->getUser() !== $comment->getParentComment()->getUser()) { $socialActivity2 = (new SocialActivity(SocialActivity::TYPE_COMMENT_REPLIED, $comment->getUser(), $micropetition->getGroup()))->setTarget($target)->setRecipient($comment->getParentComment()->getUser()); $this->em->persist($socialActivity2); $this->em->flush($socialActivity2); } }
public function getCommentBody() { $this->__load(); return parent::getCommentBody(); }