public function __construct(SessionEventUser $sessionEventUser)
 {
     $sessionEvent = $sessionEventUser->getSessionEvent();
     $session = $sessionEvent->getSession();
     $course = $session->getCourse();
     $user = $sessionEventUser->getUser();
     $details = [];
     $details['username'] = $user->getUsername();
     $details['firsName'] = $user->getFirstName();
     $details['lastName'] = $user->getLastName();
     $details['sessionEventId'] = $sessionEvent->getId();
     $details['sessionEventName'] = $sessionEvent->getName();
     $details['sessionId'] = $session->getId();
     $details['sessionName'] = $session->getName();
     $details['sessionCreationDate'] = $session->getCreationDate()->format('d/m/Y H:i:s');
     $details['courseId'] = $course->getId();
     $details['courseTitle'] = $course->getTitle();
     $details['courseCode'] = $course->getCode();
     $registrationDate = $sessionEventUser->getRegistrationDate();
     if (!is_null($registrationDate)) {
         $details['registrationDate'] = $registrationDate->format('d/m/Y H:i:s');
     }
     parent::__construct(self::ACTION, $details, $user);
 }
Esempio n. 2
0
 public function createSessionEventUser(User $user, SessionEvent $sessionEvent, $registrationStatus, $registrationDate = null, $applicationDate = null)
 {
     $sessionEventUser = new SessionEventUser();
     $sessionEventUser->setSessionEvent($sessionEvent);
     $sessionEventUser->setUser($user);
     $sessionEventUser->setRegistrationStatus($registrationStatus);
     $sessionEventUser->setRegistrationDate($registrationDate);
     $sessionEventUser->setApplicationDate($applicationDate);
     $this->om->persist($sessionEventUser);
     $this->om->flush();
     if ($registrationStatus === SessionEventUser::REGISTERED) {
         $event = new LogSessionEventUserRegistrationEvent($sessionEvent, $user);
         $this->eventDispatcher->dispatch('log', $event);
     }
     return $sessionEventUser;
 }