public function load(ObjectManager $manager)
 {
     $data = $this->container->get('ilioscore.dataloader.curriculumInventoryReport')->getAll();
     foreach ($data as $arr) {
         $entity = new CurriculumInventoryReport();
         $entity->setId($arr['id']);
         $manager->persist($entity);
         $this->addReference('curriculumInventoryReports' . $arr['id'], $entity);
     }
     $manager->flush();
 }
 public function load(ObjectManager $manager)
 {
     $data = $this->container->get('ilioscore.dataloader.curriculumInventoryReport')->getAll();
     foreach ($data as $arr) {
         $entity = new CurriculumInventoryReport();
         $entity->setId($arr['id']);
         $entity->setName($arr['name']);
         $entity->setDescription($arr['description']);
         $entity->setYear($arr['year']);
         $entity->setStartDate(new \DateTime($arr['startDate']));
         $entity->setEndDate(new \DateTime($arr['endDate']));
         $entity->setProgram($this->getReference('programs' . $arr['program']));
         $manager->persist($entity);
         $this->addReference('curriculumInventoryReports' . $arr['id'], $entity);
     }
     $manager->flush();
 }
 public function testCommandPrintsOutNewReportIdOnSuccess()
 {
     $reportId = '1';
     $newReportId = 5;
     $this->service->shouldReceive('rollover')->andReturnUsing(function () use($newReportId) {
         $report = new CurriculumInventoryReport();
         $report->setId($newReportId);
         return $report;
     });
     $this->reportManager->shouldReceive('findOneBy')->with(['id' => $reportId])->andReturnUsing(function () use($reportId) {
         $report = new CurriculumInventoryReport();
         $report->setId($reportId);
         return $report;
     });
     $this->commandTester->execute(['command' => self::COMMAND_NAME, 'reportId' => $reportId]);
     $this->service->shouldHaveReceived('rollover')->withAnyArgs()->once();
     $output = $this->commandTester->getDisplay();
     $this->assertEquals("The given report has been rolled over. The new report id is {$newReportId}.", trim($output));
 }