1

I am working on a migration where I have two vocabularies that I am merging into one vocabulary in the new site. The problem I am having is when trying to migrate the node that has the two old vocabularies the field is mapped only once.

// Code to merge two vocabulary into one (Working like a charm):

  $vocabulary_arguments = array(
    'Tag' => array(
      'description' => t('Migration of news terms from Drupal 6'),
      'source_vocabulary' => '8',  // D6 Vocabulary ID
      'destination_vocabulary' => 'tag',
    ),
    'TagEntry' => array(
      'description' => t('Migration of blog tags terms from Drupal.'),
      'source_vocabulary' => '7',  // D6 Vocabulary ID
      'destination_vocabulary' => 'tag',
    ),
  );

// Code to merge content type with two vocabularies (last mapping stay)

  $node_arguments = array(
    'Blog' => array(
      'class_name' => 'MyBlogMigration',
      'description' => t('Migration of blog nodes from Drupal 6'),
      'source_type' => 'blog',
      'destination_type' => 'blog',
      'dependencies' => array('Tag', 'TagEntry'),
    ),
  );

// My BlogMigration

class MyBlogMigration extends MymoverNodeMigration {
  public function __construct(array $arguments) {

    parent::__construct($arguments);

    $this->addFieldMapping('field_tag', '7')
         ->sourceMigration('TagEntry');
    $this->addFieldMapping('field_tag:source_type')->defaultValue('tid');
    $this->addFieldMapping('field_tag:create_term')->defaultValue(FALSE);
    $this->addFieldMapping('field_tag:ignore_case')->defaultValue(TRUE);

    $this->addFieldMapping('field_tag', '8')
         ->sourceMigration('Tag');
    $this->addFieldMapping('field_tag:source_type')->defaultValue('tid');
    $this->addFieldMapping('field_tag:create_term')->defaultValue(FALSE);
    $this->addFieldMapping('field_tag:ignore_case')->defaultValue(TRUE);


    $this->addFieldMapping('pathauto', NULL, FALSE)->defaultValue(1);

  }
}

What am I missing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.