public function load(ObjectManager $manager) { $data = $this->container->get('ilioscore.dataloader.report')->getAll(); foreach ($data as $arr) { $entity = new Report(); $entity->setId($arr['id']); $entity->setTitle($arr['title']); $entity->setSubject($arr['subject']); $manager->persist($entity); $this->addReference('reports' . $arr['id'], $entity); } $manager->flush(); }
public function load(ObjectManager $manager) { $data = $this->container->get('ilioscore.dataloader.report')->getAll(); foreach ($data as $arr) { $entity = new Report(); $entity->setId($arr['id']); $entity->setTitle($arr['title']); $entity->setSubject($arr['subject']); if (array_key_exists('prepositionalObject', $arr)) { $entity->setPrepositionalObject($arr['prepositionalObject']); } if (array_key_exists('prepositionalObjectTableRowId', $arr)) { $entity->setPrepositionalObjectTableRowId($arr['prepositionalObjectTableRowId']); } $entity->setUser($this->getReference('users' . $arr['user'])); if (array_key_exists('school', $arr)) { $entity->setSchool($this->getReference('schools' . $arr['school'])); } $manager->persist($entity); $this->addReference('reports' . $arr['id'], $entity); } $manager->flush(); }