Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It would be really useful to have a UI tool for testing migration process configuration on the fly.
At the moment, when something goes wrong with processing, you have to tweak the config file, do config-devel-import, run a migration again, watch it fail, repeat.
I am thinking a UI that has a form that lets you specify:
- the migration ID
- a single source ID to try to import
- a text area into which to paste process YML configuration
It's possible to pass process configuration to a migration on the fly, like this:
$migration_id = 'mymigration';
$manager = \Drupal::service('plugin.manager.config_entity_migration');
$migration = $manager->createInstance($migration_id);
// This is anything that could go under 'process:' in a migration config file:
$process_yaml = <<<EOT
type: field_foo/0/value
EOT;
$process = [
"type" => "field_section/0/value",
];
$process = \Symfony\Component\Yaml\Yaml::parse($process_yaml);
$migration->setProcess($process);
$log = new Drupal\migrate_tools\DrushLogMigrateMessage();
$executable = new Drupal\migrate_tools\MigrateExecutable($migration, $log, []);
$source = $migration->getSourcePlugin();
$source->rewind();
$source->valid();
$row = $source->current();
dsm($row);
$executable->processRow($row);
dsm($row);
The second output of $row shows the processed data in its destination property.
Comments
Comment #2
heddn