/** * 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(); }
public function testGetConfigurationFields() { $reader = new YamlReader(); $this->assertEquals(array('filePath' => array('system' => true), 'multiple' => array('system' => true)), $reader->getConfigurationFields()); }
public function testGetConfigurationFields() { $reader = new YamlReader(); $this->assertEquals(['filePath' => array('options' => array('label' => 'pim_base_connector.import.yamlFilePath.label', 'help' => 'pim_base_connector.import.yamlFilePath.help')), 'uploadAllowed' => array('type' => 'switch', 'options' => array('label' => 'pim_base_connector.import.uploadAllowed.label', 'help' => 'pim_base_connector.import.uploadAllowed.help'))], $reader->getConfigurationFields()); }