Given the CSV example below using the migrate_source_csv:
id, subject, chapter, tutorial
1, Drupal, Chapter 01, Tutorial 01
2, Drupal, Chapter 02, Tutorial 02
3, Drupal, Chapter 03, Tutorial 03
4, Drupal, Chapter 04, Tutorial 04
5, Drupal, Chapter 05, Tutorial 05
Is it possible to process the subject column to create:
- A single "drupal" taxonomy term.
- Multiple "drupal" taxonomy references.
entity_generate provides one workaround but does not allow for rollbacks.
So my thought was, to try and import the subjects in its own migration, which would allow for content rollbacks, then use another migration to lookup those subjects for the entity references.
The problem is, I can't find a way to generate just one taxonomy term, and end up with 5 copies of the "Drupal" subject, instead of just one. Can anyone assist/provide a workaround?
Comments
Solved (Tid lookup)
Figured this out, here's a fix for anyone searching, it uses the migration_lookup plugin to match the tid to the vid of anything already created. So any items created beyond the first just update the original, instead of creating multiple copies.
Here's the full migration that turned the 5 drupal subjects from the CSV into just one.