示例#1
0
 /**
  * @param mixed $readItem
  *
  * @return mixed processed item
  */
 protected function process($readItem)
 {
     try {
         return $this->processor->process($readItem);
     } catch (InvalidItemException $e) {
         $this->handleStepExecutionWarning($this->stepExecution, $this->processor, $e);
         return null;
     }
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function load($file)
 {
     $this->eventDispatcher->dispatch(static::EVENT_STARTED, new FixtureLoaderEvent($file));
     $this->reader->setFilePath($file);
     if ($this->multiple) {
         $items = $this->reader->read();
         foreach ($this->processor->process($items) as $object) {
             $this->persistObjects($object);
         }
     } else {
         while ($item = $this->reader->read()) {
             $this->persistObjects($this->processor->process($item));
         }
     }
     $this->objectManager->flush();
     $this->objectManager->clear();
     $this->doctrineCache->clear();
     $this->eventDispatcher->dispatch(static::EVENT_COMPLETED, new FixtureLoaderEvent($file));
 }