public function load(ObjectManager $manager) { $data = $this->container->get('ilioscore.dataloader.cohort')->getAll(); foreach ($data as $arr) { $entity = new Cohort(); $entity->setId($arr['id']); $entity->setTitle($arr['title']); $entity->setProgramYear($this->getReference('programYears' . $arr['programYear'])); $manager->persist($entity); $this->addReference('cohorts' . $arr['id'], $entity); } $manager->flush(); }