public function load(ObjectManager $manager)
 {
     $data = $this->container->get('ilioscore.dataloader.programYear')->getAll();
     foreach ($data as $arr) {
         $entity = new ProgramYear();
         $entity->setId($arr['id']);
         $entity->setStartYear($arr['startYear']);
         $entity->setLocked($arr['locked']);
         $entity->setArchived($arr['archived']);
         $entity->setPublishedAsTbd($arr['publishedAsTbd']);
         $entity->setPublished($arr['published']);
         $entity->setProgram($this->getReference('programs' . $arr['program']));
         foreach ($arr['terms'] as $id) {
             $entity->addTerm($this->getReference('terms' . $id));
         }
         foreach ($arr['objectives'] as $id) {
             $entity->addObjective($this->getReference('objectives' . $id));
         }
         foreach ($arr['competencies'] as $id) {
             $entity->addCompetency($this->getReference('competencies' . $id));
         }
         $manager->persist($entity);
         $this->addReference('programYears' . $arr['id'], $entity);
     }
     $manager->flush();
 }
Exemple #2
0
 public function load(ObjectManager $manager)
 {
     $data = $this->container->get('ilioscore.dataloader.programYear')->getAll();
     foreach ($data as $arr) {
         $entity = new ProgramYear();
         $entity->setId($arr['id']);
         $entity->setStartYear($arr['startYear']);
         $entity->setDeleted($arr['deleted']);
         $entity->setLocked($arr['locked']);
         $entity->setArchived($arr['archived']);
         $entity->setPublishedAsTbd($arr['publishedAsTbd']);
         if (!empty($arr['publishEvent'])) {
             $entity->setPublishEvent($this->getReference('publishEvents' . $arr['publishEvent']));
         }
         $entity->setProgram($this->getReference('programs' . $arr['program']));
         $manager->persist($entity);
         $this->addReference('programYears' . $arr['id'], $entity);
     }
     $manager->flush();
 }