Ejemplo n.º 1
0
 public function publishLeaderEventToActivity(LeaderEvent $event)
 {
     $publishedAt = new \DateTime();
     //update event
     $event->setPublishedAt($publishedAt);
     $this->entityManager->persist($event);
     //create activity
     $activity = new ActivityLeaderEvent();
     $activity->setQuestionId($event->getId());
     $activity->setTitle($event->getTitle());
     $activity->setDescription($event->getSubject());
     $activity->setSentAt($publishedAt);
     $activity->setExpireAt($event->getStartedAt());
     $userMethod = 'set' . $this->getClassName($event->getUser());
     $activity->{$userMethod}($event->getUser());
     $this->setImage($activity, $event);
     $this->cm->addPollRootComment($event, $event->getSubject());
     //send push notifications
     $this->pushSender->addToQueue('sendPushPublishQuestion', [$event->getId(), "RSVP: {$event->getTitle()}"]);
     $this->entityManager->persist($activity);
     $this->entityManager->flush();
     $this->createActivityConditionsForQuestion($activity, $event);
     return $activity;
 }
 public function setDescription($description)
 {
     $this->__load();
     return parent::setDescription($description);
 }