/** * {@inheritdoc} */ public function load(ObjectManager $manager) { $data = $this->container->get('ilioscli.dataloader.auditlog')->getAll(); foreach ($data as $arr) { $entity = new AuditLog(); $entity->setObjectId($arr['objectId']); $entity->setObjectClass($arr['objectClass']); $entity->setValuesChanged($arr['valuesChanged']); $entity->setCreatedAt($arr['createdAt']); $entity->setAction($arr['action']); $manager->persist($entity); } $manager->flush(); }
/** * @return array */ public function testExecuteProvider() { $schoolA = new School(); $schoolA->setId(1); $schoolA->setTitle('Medicine'); $schoolA->setIliosAdministratorEmail('*****@*****.**'); $schoolA->setChangeAlertRecipients('recipientA@som.edu,recipientB@som.edu'); $schoolB = new School(); $schoolB->setTitle('Dentistry'); $schoolB->setId(2); $schoolA->setIliosAdministratorEmail('*****@*****.**'); $schoolB->setChangeAlertRecipients('*****@*****.**'); $course = new Course(); $course->setId(1); $course->setTitle('Course <strong>A</strong>'); $course->setExternalId('ILIOS123'); $course->setSchool($schoolA); $sessionType = new SessionType(); $sessionType->setId(1); $sessionType->setTitle('Session Type A'); $session = new Session(); $session->setId(1); $session->setCourse($course); $session->setSessionType($sessionType); $session->setTitle('<i>Session A</i>'); $instructor1 = new User(); $instructor1->setId(1); $instructor1->setFirstName("D'jango"); $instructor1->setLastName("D'avila"); $instructor1->setEmail('*****@*****.**'); $instructor2 = new User(); $instructor2->setId(2); $instructor2->setFirstName('Mike'); $instructor2->setLastName('Smith'); $instructor2->setEmail('*****@*****.**'); $instructorGroup = new InstructorGroup(); $instructorGroup->setId(1); $instructorGroup->addUser($instructor2); $learnerGroup = new LearnerGroup(); $learnerGroup->setId(1); $learnerGroup->setTitle('Learner <em>Group</em> A'); $learner = new User(); $learner->setId(2); $learner->setFirstName('Jimmy'); $learner->setLastName("O'Mulligan"); $offering = new Offering(); $offering->setId(1); $offering->setSession($session); $offering->setStartDate(new \DateTime('2015-10-01 15:15:00', new \DateTimeZone('UTC'))); $offering->setEndDate(new \DateTime('2015-10-01 18:30:00', new \DateTimeZone('UTC'))); $offering->setRoom('Library - Room 119'); $offering->addInstructorGroup($instructorGroup); $offering->addInstructor($instructor1); $offering->addLearnerGroup($learnerGroup); $offering->addLearner($learner); $alert = new Alert(); $alert->setId(1); $alert->setDispatched(false); $alert->setTableName('offering'); $alert->setTableRowId(1); $alert->addRecipient($schoolA); $i = 0; foreach (['A', 'B', 'C'] as $letter) { $alertChangeType = new AlertChangeType(); $alertChangeType->setId(++$i); $alertChangeType->setTitle("Alert Change Type {$letter}"); $alert->addChangeType($alertChangeType); } $userA = new User(); $userA->setId(1); $userA->setFirstName("K'aren"); $userA->setLastName("D'lunchtime"); $userB = new User(); $userB->setId(2); $userB->setFirstName('Billy'); $userB->setLastName('Brown'); $logA = new AuditLog(); $logA->setObjectClass('alert'); $logA->setObjectId(1); $logA->setUser($userA); $logA->setCreatedAt(new \DateTime('2015-09-20 11:12:22', new \DateTimeZone('UTC'))); $logB = new AuditLog(); $logB->setObjectClass('alert'); $logB->setObjectId(1); $logB->setUser($userB); $logB->setCreatedAt(new \DateTime('2015-09-20 15:20:15', new \DateTimeZone('UTC'))); return [[$alert, $offering, [$logA, $logB]]]; }
/** * @covers \Ilios\CoreBundle\Entity\AuditLog::setObjectId * @covers \Ilios\CoreBundle\Entity\AuditLog::getObjectId */ public function testSetObjectIdForcesInt() { $this->object->setObjectId(''); $this->assertSame(0, $this->object->getObjectId()); }