public function load(ObjectManager $manager) { $data = $this->container->get('ilioscore.dataloader.term')->getAll(); foreach ($data as $arr) { $entity = new Term(); $entity->setId($arr['id']); $entity->setTitle($arr['title']); $entity->setDescription($arr['description']); $entity->setActive($arr['active']); $entity->setVocabulary($this->getReference('vocabularies' . $arr['vocabulary'])); if (isset($arr['parent'])) { $entity->setParent($this->getReference('terms' . $arr['parent'])); } foreach ($arr['aamcResourceTypes'] as $id) { $entity->addAamcResourceType($this->getReference('aamcResourceTypes' . $id)); } $manager->persist($entity); $this->addReference('terms' . $arr['id'], $entity); } $manager->flush(); }