Q for Drupal 7.34, migrate 7.x-2.7 as of 9-Feb-2015.

In MigrateDestinationNode, one can write/map the nid and set is_new=TRUE:
this creates a new node with the given nid.

In MigrateDestinationComment, writing/mapping the cid creates the comment body field,
but not the comment itself (and there is no is_new destination field).

Is there a possibility to write the cid upon comment creation too?
---
Reason: I would like to preprocess the input (lots of links to comments,
with a complicated structure, domain part rewriting of the url, etc: path auto
would solve only small parts of my migration tasks. So I would like to transform
not during migration but with a C++ pre-migration tool and for this,
I need to know the comment cid-s before migration (use old system CIDs)
I need this pre-migration tool anyway, it already does a whole lot of stuff.

Comments

wusel’s picture

Did you look at the link system-of-record is DESTINATION (https://www.drupal.org/node/1117454) for cid at MigrateDestinationComment (https://www.drupal.org/node/1349714)?

Good luck!

Wusel

J.R.’s picture

I solved it with a trick: I set AUTO_INCREMENT before writing the comment.
It 's hack, but it works. I could save most internal links (important for me).

I first tried with a dummy import setting the id (too unstable), then
setting in in prepareRow for each row (too slow), then once per csv file
(so I can roll back that particular file and restart): that's what I kept.

I have a C++ preprocessor (ningjscon2csv) which does all the parsing
and all remapping of ids, remapping of urls, renumbering of ids if req.
I use migrate (migrate_ning) only to load this generated CSV structure.

I published my (first) solution under GPL, see:
https://www.drupal.org/node/2321831#comment-9809851
Will add further improvements there.