8.5.x SourcePluginBase.php SourcePluginBase::next()
8.0.x SourcePluginBase.php SourcePluginBase::next()
8.1.x SourcePluginBase.php SourcePluginBase::next()
8.2.x SourcePluginBase.php SourcePluginBase::next()
8.3.x SourcePluginBase.php SourcePluginBase::next()
8.4.x SourcePluginBase.php SourcePluginBase::next()
8.6.x SourcePluginBase.php SourcePluginBase::next()

The migration iterates over rows returned by the source plugin. This method determines the next row which will be processed and imported into the system.

The method tracks the source and destination IDs using the ID map plugin.

This also takes care about highwater support. Highwater allows to reimport rows from a previous migration run, which got changed in the meantime. This is done by specifying a highwater field, which is compared with the last time, the migration got executed (originalHighWater).

1 call to SourcePluginBase::next()
SourcePluginBase::rewind in core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php
Rewinds the iterator.


core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php, line 346


The base class for source plugins.




public function next() {
  $this->currentSourceIds = NULL;
  $this->currentRow = NULL;

  // In order to find the next row we want to process, we ask the source
  // plugin for the next possible row.
  while (!isset($this->currentRow) && $this
    ->valid()) {
    $row_data = $this
      ->current() + $this->configuration;
    $row = new Row($row_data, $this->migration
      ->getIds(), $this->migration

    // Populate the source key for this row.
    $this->currentSourceIds = $row

    // Pick up the existing map row, if any, unless fetchNextRow() did it.
    if (!$this->mapRowAdded && ($id_map = $this->idMap
      ->getRowBySource($this->currentSourceIds))) {

    // Clear any previous messages for this row before potentially adding
    // new ones.
    if (!empty($this->currentSourceIds)) {
        ->delete($this->currentSourceIds, TRUE);

    // Preparing the row gives source plugins the chance to skip.
    if ($this
      ->prepareRow($row) === FALSE) {

    // Check whether the row needs processing.
    // 1. This row has not been imported yet.
    // 2. Explicitly set to update.
    // 3. The row is newer than the current highwater mark.
    // 4. If no such property exists then try by checking the hash of the row.
    if (!$row
      ->getIdMap() || $row
      ->needsUpdate() || $this
      ->aboveHighwater($row) || $this
      ->rowChanged($row)) {
      $this->currentRow = $row
    if ($this
      ->getHighWaterProperty()) {