I had to do this recently, where photo gallery nodes in the Drupal 6 site needed to be translated to photo category terms in the Drupal 7 site. Because the migrate_d2d base classes assume like-to-like, you're pretty much got to implement the migration from scratch - here's a simplified version of the class I implemented:
/**
* Gallery migration is special, because we're converting nodes into terms -
* the standard migrate_d2d classes won't do.
*/
class AAGallery6Migration extends DrupalMigration {
/**
* The machine name of the node type we're migrating from.
*
* @var string
*/
protected $sourceType;
/**
* The machine name of the Drupal 7 vocabulary we're migrating into.
*
* @var string
*/
protected $destinationVocabulary;
public function __construct($arguments) {
parent::__construct($arguments);
$this->sourceType = $arguments['source_type'];
$this->destinationVocabulary = $arguments['destination_vocabulary'];
// Create our three main objects - source, destination, and map
$this->source = new MigrateSourceSQL($this->query(), $this->sourceFields,
NULL, $this->sourceOptions);
$this->destination = new MigrateDestinationTerm($this->destinationVocabulary);
$this->map = new MigrateSQLMap($this->machineName,
array(
'nid' => array('type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Source node ID',
),
),
MigrateDestinationTerm::getKeySchema()
);
$this->addFieldMapping('name', 'title');
$this->addUnmigratedDestinations(array(
'description',
'format',
'parent',
'parent_name',
'path',
'pathauto',
'weight',
));
$this->addUnmigratedSources(array('changed'));
}
/**
* Query the gallery nodes - all we need is the title.
*
* @return QueryConditionInterface
*/
protected function query() {
$query = Database::getConnection('default', $this->sourceConnection)
->select('node', 'n')
->fields('n', array('nid', 'title', 'changed'))
->condition('type', $this->sourceType);
return $query;
}
}
So, your D6 nodes had used Term Fields to reference terms in D6? And now, you want the D7 terms you created from your D6 nodes to reference those other terms as well? That should be simple enough to do, by adding term references to the D7 terms, and mapping the old reference fields to the new ones. Or am I misunderstanding something?
Comments
Comment #1
mikeryanI had to do this recently, where photo gallery nodes in the Drupal 6 site needed to be translated to photo category terms in the Drupal 7 site. Because the migrate_d2d base classes assume like-to-like, you're pretty much got to implement the migration from scratch - here's a simplified version of the class I implemented:
Is this helpful?
Comment #2
kurtzhong commentedThanks, but i also got some taxonomy_reference fields on the original D6 content type. How can i do this?
Comment #3
mikeryanSo, your D6 nodes had used Term Fields to reference terms in D6? And now, you want the D7 terms you created from your D6 nodes to reference those other terms as well? That should be simple enough to do, by adding term references to the D7 terms, and mapping the old reference fields to the new ones. Or am I misunderstanding something?
Comment #4
mikeryanNo further response.