public function MigrationEventSubscriber::debugRowPreSave in Migrate Devel 8.2
Same name and namespace in other branches
- 8 src/EventSubscriber/MigrationEventSubscriber.php \Drupal\migrate_devel\EventSubscriber\MigrationEventSubscriber::debugRowPreSave()
Pre Row Save Function for --migrate-debug-pre.
Parameters
\Drupal\migrate\Event\MigratePreRowSaveEvent $event: Pre-Row-Save Migrate Event.
File
- src/
EventSubscriber/ MigrationEventSubscriber.php, line 23
Class
- MigrationEventSubscriber
- MigrationEventSubscriber for Debugging Migrations.
Namespace
Drupal\migrate_devel\EventSubscriberCode
public function debugRowPreSave(MigratePreRowSaveEvent $event) {
if (PHP_SAPI !== 'cli') {
return;
}
$row = $event
->getRow();
if (in_array('migrate-debug-pre', \Drush\Drush::config()
->get('runtime.options'))) {
// Start with capital letter for variables since this is actually a label.
$Source = $row
->getSource();
$Destination = $row
->getDestination();
// Uses Symfony VarDumper.
// @todo Explore advanced usage of CLI dumper class for nicer output.
// https://www.drupal.org/project/migrate_devel/issues/3151276
dump('---------------------------------------------------------------------', '| $Source |', '---------------------------------------------------------------------', $Source, '---------------------------------------------------------------------', '| $Destination |', '---------------------------------------------------------------------', $Destination);
}
}