/** * @covers \Ilios\CoreBundle\Entity\Term::__construct */ public function testConstructor() { $this->assertEmpty($this->object->getCourses()); $this->assertEmpty($this->object->getProgramYears()); $this->assertEmpty($this->object->getSessions()); $this->assertEmpty($this->object->getChildren()); $this->assertEmpty($this->object->getAamcResourceTypes()); }
public function load(ObjectManager $manager) { $data = $this->container->get('ilioscore.dataloader.term')->getAll(); foreach ($data as $arr) { $entity = new Term(); $entity->setId($arr['id']); $entity->setTitle($arr['title']); $entity->setDescription($arr['description']); $entity->setActive($arr['active']); $entity->setVocabulary($this->getReference('vocabularies' . $arr['vocabulary'])); if (isset($arr['parent'])) { $entity->setParent($this->getReference('terms' . $arr['parent'])); } foreach ($arr['aamcResourceTypes'] as $id) { $entity->addAamcResourceType($this->getReference('aamcResourceTypes' . $id)); } $manager->persist($entity); $this->addReference('terms' . $arr['id'], $entity); } $manager->flush(); }
/** * 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; }