public function MigrateExecutable::onPrepareRow in Migrate Tools 8.2
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.3 src/MigrateExecutable.php \Drupal\migrate_tools\MigrateExecutable::onPrepareRow()
- 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 334
Class
Namespace
Drupal\migrate_toolsCode
public function onPrepareRow(MigratePrepareRowEvent $event) {
if (!empty($this->idlist)) {
$row = $event
->getRow();
/**
* @TODO replace for $source_id = $row->getSourceIdValues(); when https://www.drupal.org/node/2698023 is fixed
*/
$migration = $event
->getMigration();
$source_id = array_merge(array_flip(array_keys($migration
->getSourcePlugin()
->getIds())), $row
->getSourceIdValues());
$skip = TRUE;
foreach ($this->idlist as $item) {
if (array_values($source_id) === $item) {
$skip = FALSE;
break;
}
}
if ($skip) {
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
->getProcessedCount() + 1 >= $this->itemLimit) {
$event
->getMigration()
->interruptMigration(MigrationInterface::RESULT_COMPLETED);
}
}