public function noticePollCommented(Comment $comment) { $question = $comment->getQuestion(); if (!$question->getUser() instanceof Group) { return; } $target = ['id' => $question->getId(), 'type' => $question->getType()]; $target['label'] = $this->getLabelByPoll($question); $target['preview'] = $this->preparePreview($comment->getCommentBody()); $socialActivity1 = (new SocialActivity(SocialActivity::TYPE_FOLLOW_POLL_COMMENTED, $comment->getUser(), $comment->getQuestion()->getUser()))->setTarget($target); if ($comment->getParentComment()->getUser()) { $target['comment_id'] = $comment->getId(); } $this->em->persist($socialActivity1); $this->em->flush($socialActivity1); if ($comment->getParentComment()->getUser() && $comment->getUser() !== $comment->getParentComment()->getUser()) { $socialActivity2 = (new SocialActivity(SocialActivity::TYPE_COMMENT_REPLIED, $comment->getUser(), $comment->getQuestion()->getUser()))->setTarget($target)->setRecipient($comment->getParentComment()->getUser()); $this->em->persist($socialActivity2); $this->em->flush($socialActivity2); $this->pt->addToQueue('sendSocialActivity', [$socialActivity2->getId()]); } }
public function getParentComment() { $this->__load(); return parent::getParentComment(); }