public function load(ObjectManager $manager) { $data = $this->container->get('ilioscore.dataloader.curriculumInventoryReport')->getAll(); foreach ($data as $arr) { $entity = new CurriculumInventoryReport(); $entity->setId($arr['id']); $entity->setName($arr['name']); $entity->setDescription($arr['description']); $entity->setYear($arr['year']); $entity->setStartDate(new \DateTime($arr['startDate'])); $entity->setEndDate(new \DateTime($arr['endDate'])); $entity->setProgram($this->getReference('programs' . $arr['program'])); $manager->persist($entity); $this->addReference('curriculumInventoryReports' . $arr['id'], $entity); } $manager->flush(); }
/** * @covers \Ilios\CoreBundle\Entity\CurriculumInventoryReport::getSchool */ public function testGetSchool() { $school = new School(); $program = new Program(); $program->setSchool($school); $report = new CurriculumInventoryReport(); $report->setProgram($program); $this->assertEquals($school, $report->getSchool()); $program = new Program(); $report = new CurriculumInventoryReport(); $report->setProgram($program); $this->assertNull($report->getSchool()); $report = new CurriculumInventoryReport(); $this->assertNull($report->getSchool()); }