/**
  * @param SessionAccess $event
  */
 public function onSessionAccessEvent(SessionAccess $event)
 {
     $user = $event->getUser();
     $course = $event->getCourse();
     $session = $event->getSession();
     $trackAccess = new TrackEAccess();
     $trackAccess->setCId($course->getId());
     $trackAccess->setAccessUserId($user->getId());
     $trackAccess->setAccessSessionId($session->getId());
     $this->em->persist($trackAccess);
     $this->em->flush();
 }
 /**
  * @param CourseAccess $event
  */
 public function onCourseAccessEvent(CourseAccess $event)
 {
     $user = $event->getUser();
     $course = $event->getCourse();
     if ($user && $course) {
         $trackAccess = new TrackEAccess();
         $trackAccess->setCId($course->getId());
         $trackAccess->setAccessUserId($user->getId());
         $trackAccess->setAccessSessionId(0);
         $this->em->persist($trackAccess);
         $this->em->flush();
     }
 }