public function isSessionValidator(User $user, CourseSession $session)
 {
     $isValidator = false;
     $validators = $session->getValidators();
     foreach ($validators as $validator) {
         if ($validator === $user) {
             $isValidator = true;
             break;
         }
     }
     return $isValidator;
 }
 public function sessionQueue(CourseSession $session, User $user)
 {
     $now = new \DateTime();
     $status = 0;
     $validators = $session->getValidators();
     if ($session->getUserValidation()) {
         $status += CourseRegistrationQueue::WAITING_USER;
     }
     if ($session->getOrganizationValidation()) {
         $status += CourseRegistrationQueue::WAITING_ORGANIZATION;
     }
     if (count($validators) > 0) {
         $status += CourseRegistrationQueue::WAITING_VALIDATOR;
     } elseif ($session->getRegistrationValidation()) {
         $status += CourseRegistrationQueue::WAITING;
     }
     $sessionQueue = new CourseSessionRegistrationQueue();
     $sessionQueue->setUser($user);
     $sessionQueue->setSession($session);
     $sessionQueue->setApplicationDate($now);
     $sessionQueue->setStatus($status);
     $this->om->persist($sessionQueue);
     return $sessionQueue;
 }