next() public method

{@inheritDoc}
public next ( )
 /**
  * @see ExecutableInterface::execute()
  */
 public function execute()
 {
     if (!$this->isStarted()) {
         throw new \Exception('Procedure not started');
     }
     if (!$this->getCurrentUnitProcedure()) {
         $this->setFinished();
         return;
     }
     // Start the next unit procedure?
     if ($this->getCurrentUnitProcedure()->isFinished()) {
         // Go to next unit procedure if possible
         if ($this->unitProcedures->next()) {
             $this->getCurrentUnitProcedure()->setEventDispatcher($this->eventDispatcher);
             $this->getCurrentUnitProcedure()->start();
         } else {
             // If last unit procedure is finished
             // set the finished flag
             $this->setFinished();
         }
     }
     // Execute
     if (!$this->finished && $this->getCurrentUnitProcedure()->isStarted()) {
         // Perform unit procedure
         $this->getCurrentUnitProcedure()->execute();
     }
 }
 /**
  * {@inheritdoc}
  */
 public function read()
 {
     $configuration = $this->getJobConfiguration();
     if (!$this->isExecuted) {
         $this->isExecuted = true;
         $this->families = $this->getFamilies($configuration['filters']);
     }
     $result = $this->families->current();
     if (!empty($result)) {
         $this->stepExecution->incrementSummaryInfo('read');
         $this->families->next();
     } else {
         $result = null;
     }
     return $result;
 }
 /**
  * Executes stage
  */
 public function execute()
 {
     if (!$this->started) {
         throw new \Exception('Operation not started');
     }
     if (!$this->phases->current()) {
         $this->setFinished();
         return;
     }
     // Start the next phase?
     if ($this->getCurrentPhase()->isFinished()) {
         // Go to next phase if possible
         if ($this->phases->next()) {
             $this->getCurrentPhase()->setEventDispatcher($this->eventDispatcher);
             $this->getCurrentPhase()->start();
         } else {
             // If last phase is finished
             // set the finished flag
             $this->setFinished();
         }
     }
     // Execute
     if (!$this->finished && $this->getCurrentPhase()->isStarted()) {
         // Perform phase
         $this->getCurrentPhase()->execute();
     }
 }
 public function next()
 {
     if (null === $this->entries) {
         $this->__load___();
     }
     return $this->entries->next();
 }
 /**
  * Tests IdentityWrapper->next()
  */
 public function testNext()
 {
     $this->assertSame(next($this->entries), $this->identityWrapper->next());
     $this->identityWrapper->last();
     $this->assertFalse($this->identityWrapper->next());
     $this->assertFalse($this->wrappedCollection->next());
 }
 /**
  * {@inheritdoc}
  */
 public function read()
 {
     $config = $this->getJobConfiguration();
     $resolver = new OptionsResolver();
     $this->configureOptions($resolver);
     $config = $resolver->resolve($config);
     if (null === $this->referenceDatas) {
         if ($config['reference_data']) {
             $this->referenceDatas = $this->getReferenceDatas($config['reference_data'], $config['ids']);
         }
     }
     $result = $this->referenceDatas->current();
     if (!empty($result)) {
         $this->stepExecution->incrementSummaryInfo('read');
         $this->referenceDatas->next();
     } else {
         $result = null;
     }
     return $result;
 }
Example #7
0
 /**
  * @dataProvider provideDifferentElements
  */
 public function testCurrent($elements)
 {
     $collection = new ArrayCollection($elements);
     $this->assertSame(current($elements), $collection->current());
     next($elements);
     $collection->next();
     $this->assertSame(current($elements), $collection->current());
 }
 /** {@inheritDoc} */
 public function next()
 {
     $this->initialize();
     return $this->collection->next();
 }
Example #9
0
 /**
  * Moves the internal iterator position to the next element and returns this element.
  *
  * @return mixed
  */
 public function next()
 {
     return $this->collection->next();
 }
 function next()
 {
     return $this->fields->next();
 }