Last updated February 7, 2013. Created by mikeryan on October 22, 2012.
Edited by Miro Goepel, DerekAhmedzai. Log in to edit this page.
Node migrations are much like term migrations, in terms of mapping a source type to a destination type.
- 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 nodes.
- 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).
- default_language: Default language for the node and the node body. Defaults to LANGUAGE_NONE.
<?php
// Use another layer of common arguments to reduce duplication
$node_arguments = $common_arguments + array(
'user_migration' => 'ExampleUser',
'default_uid' => 1,
);
$photo_node_arguments = $node_arguments + array(
'machine_name' => 'ExamplePhotoNode',
'description' => t('Import Drupal 6 photo nodes'),
'source_type' => 'photo',
'destination_type' => 'photo',
'dependencies' => array('ExamplePhotoTerm'),
);
// Note we use a custom class here so we can map the term references and
// other fields - see "Extending migrate_d2d classes" below.
Migration::registerMigration('ExamplePhotoNodeMigration',
$photo_node_arguments['machine_name'], $photo_node_arguments);
$video_node_arguments = $node_arguments + array(
'machine_name' => 'ExampleVideoNode',
'description' => t('Import Drupal 6 video nodes'),
'source_type' => 'video',
'destination_type' => 'video',
'dependencies' => array('ExampleVideoTerm'),
);
// Note we use a custom class here so we can map the term references and
// other fields - see "Extending migrate_d2d classes" below.
Migration::registerMigration('ExampleVideoNodeMigration',
$video_node_arguments['machine_name'], $video_node_arguments);
?>
Comments
Extending migrate_d2d classes
The section mentioned in the code comments "Extending migrate_d2d classes", doesn't actually exist in the documentation... there's an example module that ships with migrate_d2d though that can help out with writing Node migrations.
migrate_d2d does not create currently content types at destinati
Just wanted to add that according to #1885914: Create content types/fields, migrate_d2d does *not* current provide the ability to create Content Types at the destination.
--
..happiness is point and click..
http://www.bronius.com
Preserve NID?!
I've been searching for this answer for weeks. Will this module keep the same Node IDs when I migrate the content?
The node migration provided
The node migration provided in migrate_d2d does not maintain node ids in the destination. The underlying migrate module does, however, provide the means to reflect new node ids in other references by means of mapping references to node ids (or any primary id, for that matter) in dependent migrations. So, for example, you might migrate your files, which will result in new fid identifiers. Image fields which refer to that may be mapped using the sourceMigration('YourSourceMigrationName') chained method, such as:
<?php// in your __constructor:
$this->addFieldMapping('field_image', 'legacy_image_field_name')
->sourceMigration('MyFilesMigration);
?>
If it is essential to maintain node (and even vids), you are going to code this yourself. It might be easy -- I'm not sure. I would look at mapping the nid field as a first start.
Thanks for your response
Thanks for your response