Hi
My migrations test are on the go but actually my imported nodes doesn't keep their tags (terms) and i need to set them again.
I found a way to keep the author of imported nodes like this in my migration class :
public function __construct(array $arguments) {
parent::__construct($arguments);
//On défini la source et la cible depuis les infos de base
$this->source = new MigrateSourceSQL($this->query(),
$this->sourceFields,NULL, $this->sourceOptions);
....
//La taxonomie via champs custom
$this->addFieldMapping('taxonomy_vocabulary_2', '2');
$this->addFieldMapping('taxonomy_vocabulary_1', '1');
//Correspondance des utilisateurs et des termes
$this->addFieldMapping('uid', 'uid');
$this->addFieldMapping('tnid', 'tnid'); //doesn't work
}
but don't for terms..what is the way to keep my terms assigned to nodes ?
thanks
Comments
Comment #1
aiphesi think i found the fix but it bring me to ask :
actually
could be
so what happen to
taxonomy_vocabulary_1because i get two similar term reference fields, only thetaxonomy_vocabulary_1is necessary .the
field_taxo_vdlfield is convert from a content taxonomy field created into D6...than after the upgrade i get 2 similars fields..could i delete one of them ? so keep only one mapping...
more generally is it better to transform the core taxonomy in D6, into content taxonomy fields before upgrading a website ?
thanks
Comment #2
mikeryanIn Drupal 7, term associations are done with explicit term reference fields, like 'field_taxo_vdl'. The 'taxonomy_vocabulary' stuff would have been how you specified the vocabularies related to the node in a migration to Drupal 6.
Comment #3
aiphesok, so can i keep the 2 mapping like this ?
the first to move vocabulary terms to the vocabulary_1 and the other to tag content.
Comment #4
mikeryanIf field_taxo_vdl is your term reference field corresponding to the vocabulary that had vid=1 in the source system, that's all you need. A pseudo-field of the 'taxonomy_vocabulary' form would only be used if you were migrating to Drupal 6 - if you're using migrate_d2d, then you're migrating to Drupal 7 and thus migrating into proper term reference fields. Go to the detail page for your migration in the UI - you should see 'field_taxo_vdl' there, but no 'taxonomy_vocabulary_1'.
Comment #5
aiphesactually in the ui (admin/content/migrate/groups/BL_migration/D2D_BriseLamesNodes_ContentSortie) for source i get :
and in the destination :
more generally,do i need to use the
prepareRowfunction ?new test with functional code (d7-grawitz.vmdev) and the migration replace existing term by a stub one, rollback migration doesn't get back my previous term..:(
my code:
Comment #6
mikeryanOK, since you do have real term reference fields with the taxonomy_vocabulary names, you should map them. Use sourceMigration() as you are to relate the incoming tids to the vocabulary migrations. However, the arguments() method is deprecated, don't use that, use subfield notation:
Comment #7
aiphesYes, i think i achieve this by changing the code like this :
this one create stub because it make reference of a migration already done when i upgraded the core.
So when i use this code, term is assigned to nodes as expected :
but i get strange thing : the body content is display but when i go on edit mode, the field is empty..i'm using wysiwyg and CKE as editor.perhaps need another question ?
Comment #9
summit commentedHi,
On this page http://btmash.com/article/2012-02-16/migrate-more-less-or-how-i-learned-...
I found a term reference sort of module. I have in winzip set what I made of it.
Question one: How can I get connection without being dependent of Commerce_Migrate_Ubercart
question two: Will this module work and how can I trigger it then within Migrate D-D?
Hopefully this is the right place to bring this submodule in and are there people out there how can make this a Migrate D-D- add on to get nodes with reference to terms in.
Otherwise, does someone have a module, in winzip which does this already?
Greetings, Martijn