You are here

public function MigrateExecutable::onPrepareRow in Migrate Tools 8

Same name and namespace in other branches
  1. 8.5 src/MigrateExecutable.php \Drupal\migrate_tools\MigrateExecutable::onPrepareRow()
  2. 8.2 src/MigrateExecutable.php \Drupal\migrate_tools\MigrateExecutable::onPrepareRow()
  3. 8.3 src/MigrateExecutable.php \Drupal\migrate_tools\MigrateExecutable::onPrepareRow()
  4. 8.4 src/MigrateExecutable.php \Drupal\migrate_tools\MigrateExecutable::onPrepareRow()

React to a new row.

Parameters

\Drupal\migrate_plus\Event\MigratePrepareRowEvent $event: The prepare-row event.

Throws

\Drupal\migrate\MigrateSkipRowException

File

src/MigrateExecutable.php, line 327
Contains \Drupal\migrate_tools\MigrateExecutable.

Class

MigrateExecutable

Namespace

Drupal\migrate_tools

Code

public function onPrepareRow(MigratePrepareRowEvent $event) {
  if ($this->idlist) {
    $row = $event
      ->getRow();
    $source_id = $row
      ->getSourceIdValues();
    if (!in_array(reset($source_id), $this->idlist)) {
      throw new MigrateSkipRowException(NULL, FALSE);
    }
  }
  if ($this->feedback && $this->counter && $this->counter % $this->feedback == 0) {
    $this
      ->progressMessage(FALSE);
    $this
      ->resetCounters();
  }
  $this->counter++;
  if ($this->itemLimit && $this->counter >= $this->itemLimit) {
    $event
      ->getMigration()
      ->interruptMigration(MigrationInterface::RESULT_COMPLETED);
  }
}