Beispiel #1
0
 public function load(ObjectManager $manager)
 {
     $data = $this->container->get('ilioscore.dataloader.user')->getAll();
     foreach ($data as $arr) {
         $entity = new User();
         $entity->setId($arr['id']);
         $entity->setFirstName($arr['firstName']);
         $entity->setLastName($arr['lastName']);
         $entity->setMiddleName($arr['middleName']);
         $entity->setEmail($arr['email']);
         $entity->setEnabled($arr['enabled']);
         $entity->setRoot($arr['root']);
         $entity->setIcsFeedKey($arr['icsFeedKey']);
         $entity->setPhone($arr['phone']);
         $entity->setCampusId($arr['campusId']);
         $entity->setUserSyncIgnore($arr['userSyncIgnore']);
         foreach ($arr['roles'] as $id) {
             $entity->addRole($this->getReference('userRoles' . $id));
         }
         foreach ($arr['cohorts'] as $id) {
             $entity->addCohort($this->getReference('cohorts' . $id));
         }
         $entity->setSchool($this->getReference('schools' . $arr['school']));
         if (isset($arr['primaryCohort'])) {
             $entity->setPrimaryCohort($this->getReference('cohorts' . $arr['primaryCohort']));
         }
         foreach ($arr['programYears'] as $id) {
             $entity->addProgramYear($this->getReference('programYears' . $id));
         }
         foreach ($arr['directedSchools'] as $id) {
             $entity->addDirectedSchool($this->getReference('schools' . $id));
         }
         foreach ($arr['administeredSchools'] as $id) {
             $entity->addAdministeredSchool($this->getReference('schools' . $id));
         }
         foreach ($arr['directedPrograms'] as $id) {
             $entity->addDirectedProgram($this->getReference('programs' . $id));
         }
         $manager->persist($entity);
         $this->addReference('users' . $arr['id'], $entity);
     }
     $manager->flush();
 }