Пример #1
0
 public function publishLeaderNewsToActivity(LeaderNews $news)
 {
     $expireDate = new \DateTime('now');
     $expireDate->add(new \DateInterval('P' . $this->settings->get(Settings::DEFAULT_EXPIRE_INTERVAL)->getValue() . 'D'));
     $activity = new ActivityLeaderNews();
     $activity->setQuestionId($news->getId());
     $activity->setTitle('');
     $activity->setDescription(strip_tags($news->getSubjectParsed()));
     $activity->setSentAt($news->getPublishedAt());
     $activity->setExpireAt($expireDate);
     $method = 'set' . ucfirst($news->getUser()->getType());
     $activity->{$method}($news->getUser());
     $this->setImage($activity, $news);
     $this->cm->addPollRootComment($news, $news->getSubject());
     $this->pushSender->addToQueue('sendPushPublishQuestion', [$news->getId(), "Discuss: {$this->preview($news->getSubject())}"]);
     $this->entityManager->persist($activity);
     $this->entityManager->flush();
     $this->createActivityConditionsForQuestion($activity, $news);
     return $activity;
 }
 public function setSentAt($sentAt)
 {
     $this->__load();
     return parent::setSentAt($sentAt);
 }