Esempio n. 1
0
 /**
  * @param FeedEntity               $feed
  * @param ReaderInterface          $reader
  * @param EventDispatcherInterface $dispatcher
  * @param array                    $options
  *
  * @return Feed
  */
 protected function createFeed(FeedEntity $feed, ReaderInterface $reader, EventDispatcherInterface $dispatcher, array $options = [])
 {
     $builder = new FeedBuilder($dispatcher);
     $type = $this->importRegistry->getFeedType($feed->getType());
     $options = array_merge($options, $feed->getOptions());
     return $builder->build($type, $reader, $options);
 }
 /**
  * @param Feed                     $feed
  * @param string                   $fixtureName
  * @param EventDispatcherInterface $dispatcher
  * @param array                    $options
  *
  * @return ReaderInterface
  */
 protected function createReader(Feed $feed, $fixtureName, EventDispatcherInterface $dispatcher, array $options = [])
 {
     $readerType = $this->getImportRegistry()->getReaderType($feed->getReaderType());
     $refl = new \ReflectionClass(get_class($this));
     $xml = sprintf('%s/fixtures/%s/%s.xml', dirname($refl->getFileName()), $feed->getType(), $fixtureName);
     $transportConfig = TransportFactory::createConfigFromFile($xml);
     $builder = new ReaderBuilder($dispatcher, sys_get_temp_dir() . '/' . $feed->getType());
     return $builder->build($readerType, $transportConfig, $builder::RESOURCE_TYPE_MAIN, $options);
 }