示例#1
0
 public function load(ObjectManager $manager)
 {
     $data = $this->container->get('ilioscore.dataloader.ilmSession')->getAll();
     foreach ($data as $arr) {
         $entity = new IlmSession();
         $entity->setId($arr['id']);
         $entity->setHours($arr['hours']);
         $entity->setDueDate(new \DateTime($arr['dueDate']));
         $entity->setSession($this->getReference('sessions' . $arr['session']));
         foreach ($arr['instructors'] as $id) {
             $entity->addInstructor($this->getReference('users' . $id));
         }
         foreach ($arr['instructorGroups'] as $id) {
             $entity->addInstructorGroup($this->getReference('instructorGroups' . $id));
         }
         foreach ($arr['learnerGroups'] as $id) {
             $entity->addLearnerGroup($this->getReference('learnerGroups' . $id));
         }
         foreach ($arr['learners'] as $id) {
             $entity->addLearner($this->getReference('users' . $id));
         }
         $manager->persist($entity);
         $this->addReference('ilmSessions' . $arr['id'], $entity);
     }
     $manager->flush();
 }
示例#2
0
 /**
  * Gets a course with a bunch of relationsips attached
  * @return Course
  */
 protected function createTestCourseWithAssociations()
 {
     $course = $this->createTestCourse();
     $course->setClerkshipType(new CourseClerkshipType());
     $course->setSchool(new School());
     $courseObjective1 = new Objective();
     $courseObjective1->setId(808);
     $courseObjective1->setTitle('test course objective1');
     $courseObjective1->addMeshDescriptor(new MeshDescriptor());
     $courseObjective1->addParent(new Objective());
     $course->addObjective($courseObjective1);
     $courseObjective2 = new Objective();
     $courseObjective2->setId(42);
     $courseObjective2->setTitle('test course objective2');
     $course->addObjective($courseObjective2);
     $courseTerm1 = new Term();
     $courseTerm1->setId(808);
     $course->addTerm($courseTerm1);
     $lm = new LearningMaterial();
     $courseLearningMaterial1 = new CourseLearningMaterial();
     $courseLearningMaterial1->setLearningMaterial($lm);
     $courseLearningMaterial1->setId(808);
     $courseLearningMaterial1->addMeshDescriptor(new MeshDescriptor());
     $courseLearningMaterial1->setNotes('notes');
     $courseLearningMaterial1->setPublicNotes(true);
     $courseLearningMaterial1->setRequired(false);
     $course->addLearningMaterial($courseLearningMaterial1);
     $course->addCohort(new Cohort());
     $session1 = new Session();
     $session1->setSessionType(new SessionType());
     $sessionObjective1 = new Objective();
     $sessionObjective1->setId(99);
     $sessionObjective1->setTitle('test session objective 1');
     $sessionObjective1->addMeshDescriptor(new MeshDescriptor());
     $sessionObjective1->addParent($courseObjective1);
     $sessionObjective1->addParent($courseObjective2);
     $session1->addObjective($sessionObjective1);
     $sessionLearningMaterial1 = new SessionLearningMaterial();
     $sessionLearningMaterial1->setLearningMaterial($lm);
     $sessionLearningMaterial1->setId(808);
     $sessionLearningMaterial1->addMeshDescriptor(new MeshDescriptor());
     $sessionLearningMaterial1->setNotes('notes');
     $sessionLearningMaterial1->setPublicNotes(true);
     $sessionLearningMaterial1->setRequired(false);
     $session1->addLearningMaterial($sessionLearningMaterial1);
     $sessionTerm1 = new Term();
     $sessionTerm1->setId(808);
     $session1->addTerm($sessionTerm1);
     $description = new SessionDescription();
     $description->setDescription('test description');
     $session1->setSessionDescription($description);
     $user = new User();
     $offering1 = new Offering();
     $offering1->setRoom('111b');
     $offering1->setSite('Off Campus');
     $offering1->setStartDate(new DateTime('8am'));
     $offering1->setEndDate(new DateTime('9am'));
     $offering1->addInstructor($user);
     $offering1->addLearner($user);
     $instructorGroup = new InstructorGroup();
     $instructorGroup->addUser($user);
     $offering1->addInstructorGroup($instructorGroup);
     $learnerGroup = new LearnerGroup();
     $learnerGroup->addUser($user);
     $offering1->addLearnerGroup($learnerGroup);
     $session1->addOffering($offering1);
     $course->addSession($session1);
     $session2 = new Session();
     $session2->setSessionType(new SessionType());
     $ilm = new IlmSession();
     $ilm->setHours(4.3);
     $ilm->setDueDate(new DateTime());
     $ilm->addInstructorGroup($instructorGroup);
     $ilm->addLearnerGroup($learnerGroup);
     $ilm->addInstructor($user);
     $ilm->addLearner($user);
     $session2->setIlmSession($ilm);
     $course->addSession($session2);
     return $course;
 }