public function load(ObjectManager $manager) { $data = $this->container->get('ilioscore.dataloader.objective')->getAll(); foreach ($data as $arr) { $entity = new Objective(); $entity->setId($arr['id']); $entity->setTitle($arr['title']); if (array_key_exists('competency', $arr)) { $entity->setCompetency($this->getReference('competencies' . $arr['competency'])); } foreach ($arr['parents'] as $id) { $entity->addParent($this->getReference('objectives' . $id)); } foreach ($arr['meshDescriptors'] as $id) { $entity->addMeshDescriptor($this->getReference('meshDescriptors' . $id)); } if (array_key_exists('ancestor', $arr)) { $entity->setAncestor($this->getReference('objectives' . $arr['ancestor'])); } $manager->persist($entity); $this->addReference('objectives' . $arr['id'], $entity); } $manager->flush(); }