In the description of MigrateDestinationTerm here:
http://drupal.org/node/1349702
the destination vocabulary is hard-wired into the example. I'm trying to move all terms from all vocabularies from an old db into D7. I have code in place to determine the new machine_name for the destination vocabulary. This information must be in MigrateDestinationTerm::$bundle which is a protected field and can only be set during object instantiation (so changing it in prepareRow() isn't an option).
I've looked at wine.inc in migrate_examples and I see there that the terms are imported vocabulary by vocabulary. That is, there are three subclasses of WineTermMigration each with their own unique constructor.
Is there a way to do this in a more automated fashion, for an arbitrary set of Vocabularies?
Comments
Comment #1
mikeryanI've added the following to the documentation page:
The vocabulary passed to the MigrateDestinationTerm constructor can be overridden on a per-term basis by mapping vocabulary_machine_name:
Comment #2
nerdcore commentedI am assuming from this example code that an appropriate place to perform this mapping is in prepareRow() because we are talking about per-term data.
So I wrote this:
But this results in warnings:
MyTermMigration addFieldMapping: vocabulary_machine_name was previously mapped, overriddenAnd my terms migration import is sticking them all into the vocabulary 'tags'.
Is there some sort of overrideFieldMapping() call? Or some other way to replace the vocabulary_machine_name in the MigrateDestinationTerm object?
Comment #3
mikeryanNo, addFieldMapping goes in your constructor. Try this:
Comment #4
nerdcore commentedThis works. Thank you.