コード例 #1
0
 public function load(ObjectManager $manager)
 {
     $data = $this->container->get('ilioscore.dataloader.curriculumInventorySequenceBlock')->getAll();
     foreach ($data as $arr) {
         $entity = new CurriculumInventorySequenceBlock();
         $entity->setId($arr['id']);
         $entity->setTitle($arr['title']);
         $entity->setTrack($arr['track']);
         $entity->setChildSequenceOrder($arr['childSequenceOrder']);
         $entity->setOrderInSequence($arr['orderInSequence']);
         $entity->setMinimum($arr['minimum']);
         $entity->setMaximum($arr['maximum']);
         $entity->setDuration($arr['duration']);
         $entity->setRequired($arr['required']);
         $entity->setStartDate(new \DateTime($arr['startDate']));
         $entity->setEndDate(new \DateTime($arr['endDate']));
         $entity->setAcademicLevel($this->getReference('curriculumInventoryAcademicLevels' . $arr['academicLevel']));
         $entity->setReport($this->getReference('curriculumInventoryReports' . $arr['report']));
         if (!empty($arr['parent'])) {
             $entity->setParent($this->getReference('curriculumInventorySequenceBlocks' . $arr['parent']));
         }
         foreach ($arr['sessions'] as $sessionId) {
             $entity->addSession($this->getReference('sessions' . $sessionId));
         }
         $manager->persist($entity);
         $this->addReference('curriculumInventorySequenceBlocks' . $arr['id'], $entity);
     }
     $manager->flush();
 }