Imported nodes and terms have no association, shouldn't this be the "default" option when doing migrations ?

Comments

mikeryan’s picture

Title: Imported nodes and terms do not have asscoiation » Automatically map term references using the UI
Component: Code » User interface
Category: Bug report » Feature request
Issue summary: View changes

You didn't provide much information here, but I'm going to go out on a limb and guess that you were using the UI and expected the term references to be mapped automatically (because if you were coding the migrations yourself doing the mapping would be squarely in your hands). Yes, it would be nice to do that - making this a feature request.

mikeryan’s picture

Unless/until the automated mapping is done, here's what you need to do:

  1. Go to the field mapping editor for your node migration.
  2. For any term reference fields, set the source field to the appropriate vocabulary on your source system, and set the source migration to the migration of that vocabulary.
  3. Right under the term reference field, there will be a ':source_type' subfield - set the default value in that row to "tid".
hongpong’s picture

I added this to documentation at https://www.drupal.org/node/1224042 in hopes it will become less onerous for others.

nicxvan’s picture

I'm not sure I see a field mapping editor for the node migration you mentioned. Is that an administration page or something that I need to build?

mikeryan’s picture

@nicxvan: In the Migrate dashboard, click the migration name to go to the detail page, then the Edit tab to get the field mapping editor.

nicxvan’s picture

Well that's a lot easier than what I was doing.

Still doesn't seem to allow merging two fields, or converting field types at first glance, but still a lot easier.

Thanks!

goldlilys’s picture

Added the tid on the default value and the migrate source .... but even when I did that, it only recognizes the tid, but it doesn't convert it to the real term name that's already stored in the taxonomy vocabulary.

Not sure if this still applies to the newest version of migrate. Can someone help?

Error: "No matching taxonomy term found for source value '1276' in vocabulary ."

where 1276 is the tid for a particular term name and it doesn't match it. But instead it seems to recognize 1276 as the term name, not as tid.

summit’s picture

StatusFileSize
new501.67 KB

Hi,
For me helped to set also the Option: Set to TRUE to create referenced terms when necessary [field_regio:create_term] and Option: Set to TRUE to ignore case differences between source data and existing term names [field_regio:ignore_case] to TRUE.
I attach my UI settings in image. The term settings are at the bottom of the image ;)
Greetings, Martijn

mikeryan’s picture

Actually, through the UI you should use "1" instead of "TRUE". Those field descriptions are general and reflect the values you would use in PHP code, through the UI PHP constants like TRUE and FALSE won't be automatically translated to 1 and 0. TRUE will actually work because of PHP's... flexibility... with data types (anything that isn't empty/NULL/0 is considered true by PHP), but FALSE won't.

rcodina’s picture

@Summit Thanks for the info! Doing the same as you I managed to import my taxonomies (putting 'tid' and 'TRUE' on 'default value' column). The error that appeared to me before solving the issue was the same as @goldlilys:

No matching taxonomy term found for source value '17' in vocabulary Equipo.

rcodina’s picture

StatusFileSize
new353.11 KB

I share my configuration which allowed me to migrate taxonomy terms and files successfully!