I have the following migration to import blog posts with multiple tags:

    $this->destination = new MigrateDestinationNode('blog_post');

    $this->addFieldMapping('field_tags', 'tags')
      ->sourceMigration('BlogTags');

    $this->addFieldMapping('field_tags:source_type')
      ->defaultValue('tid');

This code gets the terms for the blog post:

  public function prepareRow($row) {
    db_set_active('wp');
    $results = db_query("SELECT c.term_id, c.name FROM {wp_term_relationships} a INNER JOIN {wp_term_taxonomy} b ON a.term_taxonomy_id = b.term_taxonomy_id INNER JOIN {wp_terms} c ON c.term_id = b.term_id WHERE b.taxonomy = 'post_tag' AND a.object_id = :id", array(':id' => $row->ID));
    foreach ($results as $r) {
      $row->tags[] = $r->term_id;
    }
    db_set_active('default');
  }

This works fine and the new posts have associated tags. However, the migration messages shows hundreds of Field validation error for field_tags: Tags: illegal value. errors.

Is there something I can do to prevent these?

Comments

cameronbprince created an issue. See original summary.

cameron prince’s picture

Issue summary: View changes