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.
Implement the drush migrate-fields-destination command, to list available fields on the migration destination. D7 example:
$ drush mfd beerterm
beerterm Destination Fields
Existing term ID tid
Name name
Description description
Parent (by Drupal term ID) parent
Parent (by name) parent_name
Format format
Weight weight
Path alias path
Comment | File | Size | Author |
---|---|---|---|
#10 | 2630718-10.migrate_tools.migrate-fields-destination-drush.patch | 1.74 KB | joachim |
Comments
Comment #2
mikeryanFor this to work for entity destinations, we need #2630732: Implement Entity::fields() for migration destinations.
Comment #3
mikeryanWe could do this anyway, just make sure we do an is_array() on the fields() return for safety.
Comment #4
joachim CreditAttribution: joachim commentedHere's that implemented as a Drush 8 command.
The Drush 9 version will need doing -- I'm not yet using Drush 9 on my project.
Comment #5
Eli-T@joachim I was going to port this command to Drush 9 but when I tested it on Drush 8.1.16 with Drupal 8.4.4 I couldn't get any output.
I have a set of basic migrations using a plugin source that extends Drupal\migrate\Plugin\migrate\source\SqlBase and migrates to a custom node type that has standard title and body fields, plus a couple of entity references. This migration runs fine and the fields on the custom content type are correctly populated
However, running the command from the patch in #4 gives no output.
I know the command is running, because if I specify a non-existent migration id, I get the expected error message.
It looks like
$destination = $migration->getDestinationPlugin();
produces a valid instance of Drupal\migrate\Plugin\migrate\destination\EntityContentBase but$destination->fields()
returns NULL.Am I missing something or is there a problem with this approach?
Comment #6
Eli-TSorry, here's the config for the migration in question:
Comment #7
joachim CreditAttribution: joachim commented> It looks like $destination = $migration->getDestinationPlugin(); produces a valid instance of Drupal\migrate\Plugin\migrate\destination\EntityContentBase but $destination->fields() returns NULL.
You need the core patch from #2630732: Implement Entity::fields() for migration destinations.
Comment #8
heddnThis should be postponed then.
Comment #9
joachim CreditAttribution: joachim as a volunteer commentedAdded the Drush 9 command.
Comment #10
joachim CreditAttribution: joachim at Factorial GmbH commentedRerolled for the 5.x branch -- there's no more old style Drush command.