You are here

public function DataParserPluginBase::next in Migrate Plus 8.3

Same name and namespace in other branches
  1. 8.5 src/DataParserPluginBase.php \Drupal\migrate_plus\DataParserPluginBase::next()
  2. 8 src/DataParserPluginBase.php \Drupal\migrate_plus\DataParserPluginBase::next()
  3. 8.2 src/DataParserPluginBase.php \Drupal\migrate_plus\DataParserPluginBase::next()
  4. 8.4 src/DataParserPluginBase.php \Drupal\migrate_plus\DataParserPluginBase::next()

Implementation of Iterator::next().

1 call to DataParserPluginBase::next()
DataParserPluginBase::rewind in src/DataParserPluginBase.php

File

src/DataParserPluginBase.php, line 100

Class

DataParserPluginBase
Defines a base data parser implementation.

Namespace

Drupal\migrate_plus

Code

public function next() {
  $this->currentItem = $this->currentId = NULL;
  if (is_null($this->activeUrl)) {
    if (!$this
      ->nextSource()) {

      // No data to import.
      return;
    }
  }

  // At this point, we have a valid open source url, try to fetch a row from
  // it.
  $this
    ->fetchNextRow();

  // If there was no valid row there, try the next url (if any).
  if (is_null($this->currentItem)) {
    while ($this
      ->nextSource()) {
      $this
        ->fetchNextRow();
      if ($this
        ->valid()) {
        break;
      }
    }
  }
  if ($this
    ->valid()) {
    foreach ($this->configuration['ids'] as $id_field_name => $id_info) {
      $this->currentId[$id_field_name] = $this->currentItem[$id_field_name];
    }
  }
}