public function MigrateExecutable::onPrepareRow in Migrate Tools 8.4
Same name and namespace in other branches
- 8.5 src/MigrateExecutable.php \Drupal\migrate_tools\MigrateExecutable::onPrepareRow()
- 8 src/MigrateExecutable.php \Drupal\migrate_tools\MigrateExecutable::onPrepareRow()
- 8.2 src/MigrateExecutable.php \Drupal\migrate_tools\MigrateExecutable::onPrepareRow()
- 8.3 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 364
Class
- MigrateExecutable
- Defines a migrate executable class for drush.
Namespace
Drupal\migrate_toolsCode
public function onPrepareRow(MigratePrepareRowEvent $event) {
// TODO: remove after 8.6 support is sunset.
// @see https://www.drupal.org/project/migrate_tools/issues/3008316
if (!empty($this->idlist)) {
$row = $event
->getRow();
$migration = $event
->getMigration();
$source_id = $source_id = $row
->getSourceIdValues();
$skip = TRUE;
foreach ($this->idlist as $item) {
if (array_values($source_id) == $item) {
$skip = FALSE;
break;
}
}
if ($skip) {
throw new MigrateSkipRowException('Skipped due to idlist.', FALSE);
}
}
if ($this->feedback && $this->counter && $this->counter % $this->feedback == 0) {
$this
->progressMessage(FALSE);
$this
->resetCounters();
}
$this->counter++;
if ($this->itemLimit && $this->itemLimitCounter + 1 >= $this->itemLimit) {
$event
->getMigration()
->interruptMigration(MigrationInterface::RESULT_COMPLETED);
}
}