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.
Comment migrations are coupled to their corresponding node migrations - for each node type that has comments, you will define a corresponding comment migration.
- source_type: The unique machine name of the legacy node type.
- destination_type: The unique machine name of the destination node type.
- user_migration: The machine name of your user migration, used to properly assign authorship of the comments.
- default_uid: A default destination uid to use as the default author of nodes where a legacy owner isn't identified (for example, nodes authored by the account with uid 1 in the legacy system, since that account is not migrated).
- node_migration: The machine name of the migration for the nodes parenting these comments.
// Use another layer of common arguments to reduce duplication
$comment_arguments = $common_arguments + array(
'user_migration' => 'ExampleUser',
'default_uid' => 0,
);
$photo_comment_arguments = $comment_arguments + array(
'machine_name' => 'ExamplePhotoComment',
'description' => t('Import Drupal 6 photo comments'),
'source_type' => 'photo',
'destination_type' => 'photo',
'node_migration' => 'ExamplePhotoNode',
);
Migration::registerMigration('DrupalComment6Migration',
$photo_comment_arguments['machine_name'], $photo_comment_arguments);
$video_comment_arguments = $comment_arguments + array(
'machine_name' => 'ExampleVideoComment',
'description' => t('Import Drupal 6 video comments'),
'source_type' => 'video',
'destination_type' => 'video',
'node_migration' => 'ExampleVideoNode',
);
Migration::registerMigration('DrupalComment6Migration',
$video_comment_arguments['machine_name'], $video_comment_arguments);
Comments
Another way to do it more like we did the nodes
It took me some time to wrap my head around the version described above and I end up writing it up like if working with nodes.
Thank you for this great module.
Emil Orol
"In the computer business you’re either a one or a zero and I am determined never to be zero."