Example #1
0
 public function load(ObjectManager $manager)
 {
     $data = $this->container->get('ilioscore.dataloader.cohort')->getAll();
     foreach ($data as $arr) {
         $entity = new Cohort();
         $entity->setId($arr['id']);
         $entity->setTitle($arr['title']);
         $entity->setProgramYear($this->getReference('programYears' . $arr['programYear']));
         $manager->persist($entity);
         $this->addReference('cohorts' . $arr['id'], $entity);
     }
     $manager->flush();
 }
Example #2
0
 /**
  * @covers Ilios\CoreBundle\Entity\Cohort::__construct
  */
 public function testConstructor()
 {
     $this->assertEmpty($this->object->getCourses());
 }
Example #3
0
 /**
  * @covers \Ilios\CoreBundle\Entity\Cohort::getSchool
  */
 public function testGetSchool()
 {
     $school = new School();
     $program = new Program();
     $program->setSchool($school);
     $programYear = new ProgramYear();
     $programYear->setProgram($program);
     $cohort = new Cohort();
     $cohort->setProgramYear($programYear);
     $this->assertEquals($school, $cohort->getSchool());
     $program = new Program();
     $programYear = new ProgramYear();
     $programYear->setProgram($program);
     $cohort = new Cohort();
     $cohort->setProgramYear($programYear);
     $this->assertNull($cohort->getSchool());
     $programYear = new ProgramYear();
     $cohort = new Cohort();
     $cohort->setProgramYear($programYear);
     $this->assertNull($cohort->getSchool());
     $cohort = new Cohort();
     $this->assertNull($cohort->getSchool());
 }