コード例 #1
0
 /**
  * Get the input file iterator to iterate on all the lines of the file.
  *
  * @param JobParameters $jobParameters
  *
  * @return FileIteratorInterface
  */
 protected function getInputFileIterator(JobParameters $jobParameters)
 {
     $filePath = $jobParameters->get('filePath');
     $delimiter = $jobParameters->get('delimiter');
     $enclosure = $jobParameters->get('enclosure');
     $fileIterator = $this->fileIteratorFactory->create($filePath, ['reader_options' => ['fieldDelimiter' => $delimiter, 'fieldEnclosure' => $enclosure]]);
     $fileIterator->rewind();
     return $fileIterator;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 protected function getInputFileIterator(JobParameters $jobParameters)
 {
     $filePath = $jobParameters->get('filePath');
     $fileIterator = $this->fileIteratorFactory->create($filePath);
     $fileIterator->rewind();
     return $fileIterator;
 }
コード例 #3
0
 /**
  * @param JobParameters $parameters
  *
  * @return array
  */
 protected function getConverterOptions(JobParameters $parameters)
 {
     $options = [];
     if ($parameters->has('decimalSeparator')) {
         $options['decimal_separator'] = $parameters->get('decimalSeparator');
     }
     if ($parameters->has('dateFormat')) {
         $options['date_format'] = $parameters->get('dateFormat');
     }
     if ($parameters->has('ui_locale')) {
         $options['locale'] = $parameters->get('ui_locale');
     }
     return $options;
 }
コード例 #4
0
 /**
  * Are there attributes to filters ?
  *
  * @param JobParameters $parameters
  *
  * @return bool
  */
 protected function areAttributesToFilter(JobParameters $parameters)
 {
     return isset($parameters->get('filters')['structure']['attributes']) && !empty($parameters->get('filters')['structure']['attributes']);
 }
コード例 #5
0
 /**
  * @param JobParameters $parameters
  *
  * @throws \InvalidArgumentException
  *
  * @return array
  */
 protected function getNormalizerContext(JobParameters $parameters)
 {
     if (!$parameters->has('scope')) {
         throw new \InvalidArgumentException('No channel found');
     }
     $normalizerContext = ['channels' => [$parameters->get('scope')], 'locales' => $this->getLocaleCodes($parameters->get('scope')), 'filter_types' => ['pim.transform.product_value.structured', 'pim.transform.product_value.structured.quick_export']];
     return $normalizerContext;
 }