public function load(ObjectManager $manager) { $data = $this->container->get('ilioscore.dataloader.alert')->getAll(); foreach ($data as $arr) { $entity = new Alert(); $entity->setId($arr['id']); $entity->setTableName($arr['tableName']); $entity->setTableRowId($arr['tableRowId']); $entity->setDispatched($arr['dispatched']); foreach ($arr['changeTypes'] as $id) { $entity->addChangeType($this->getReference('alertChangeTypes' . $id)); } foreach ($arr['instigators'] as $id) { $entity->addInstigator($this->getReference('users' . $id)); } foreach ($arr['recipients'] as $id) { $entity->addRecipient($this->getReference('schools' . $id)); } $manager->persist($entity); $this->addReference('alerts' . $arr['id'], $entity); } $manager->flush(); }
/** * @return array */ public function testExecuteRecipientWithoutEmailProvider() { $school = new School(); $course = new Course(); $course->setSchool($school); $session = new Session(); $session->setCourse($course); $offering = new Offering(); $offering->setId(1); $offering->setSession($session); $alert = new Alert(); $alert->setId(1); $alert->setTableName('offering'); $alert->setTableRowId($offering->getId()); $alert->addRecipient($school); return [[$alert, $offering]]; }