/**
  * Load the fixture jobs in database
  *
  * @return null
  */
 public function load()
 {
     $rawJobs = array();
     $fileLocator = $this->container->get('file_locator');
     foreach ($this->jobsFilePaths as $jobsFilePath) {
         $realPath = $fileLocator->locate('@' . $jobsFilePath);
         $this->reader->setFilePath($realPath);
         // read the jobs list
         while ($rawJob = $this->reader->read()) {
             $rawJobs[] = $rawJob;
         }
         // sort the jobs by order
         usort($rawJobs, function ($item1, $item2) {
             if ($item1['order'] === $item2['order']) {
                 return 0;
             }
             return $item1['order'] < $item2['order'] ? -1 : 1;
         });
     }
     // store the jobs
     foreach ($rawJobs as $rawJob) {
         unset($rawJob['order']);
         $job = $this->processor->process($rawJob);
         $config = $job->getRawConfiguration();
         $config['filePath'] = sprintf('%s/%s', $this->installerDataPath, $config['filePath']);
         $job->setRawConfiguration($config);
         $this->em->persist($job);
     }
     $this->em->flush();
 }
 /**
  * {@inheritdoc}
  */
 protected function setItemErrors(array $item, array $errors)
 {
     if ($this->stepExecution) {
         $this->stepExecution->incrementSummaryInfo('skip');
         $this->stepExecution->addWarning($this->getName(), implode("\n", $this->getErrorMessages($errors)), [], $item);
     } else {
         parent::setItemErrors($item, $errors);
     }
 }
 protected function createProcessor($skipEmpty = false)
 {
     $processor = new TransformerProcessor($this->validator, $this->translator, $this->transformer, 'class', $skipEmpty);
     $stepExecution = $this->getMockBuilder('Akeneo\\Bundle\\BatchBundle\\Entity\\StepExecution')->disableOriginalConstructor()->getMock();
     $processor->setStepExecution($stepExecution);
     return $processor;
 }