So im migrating comments from a different database to Drupal 7 but i cant understand why this wont work. Im successful with migrating nodes, i only mapped the node fields and somehow its node_revision seemed to have automatically updated too.
But in comments it doesnt work, i know to add a comment these tables are affected in drupal:
- comment
- field_data_comment_body
- field_revision_comment_body
am i missing some mapping here in my code?
$this->addFieldMapping('cid', 'id');
$this->addFieldMapping('is_new')->defaultValue(TRUE); // i dont know what this thing does
$this->addFieldMapping('nid', 'mainthread');
$this->addFieldMapping('pid', 'parent')
->sourceMigration('ForumComment')
->description('Parent comment.');
$this->addFieldMapping('comment_body', 'body');
$this->addFieldMapping('subject', 'subject');
$this->addFieldMapping('hostname', 'host');
$this->addFieldMapping('created', 'date');
$this->addFieldMapping('changed', 'last');
$this->addFieldMapping('name', 'author');
$this->addFieldMapping('status')
->defaultValue(COMMENT_PUBLISHED);
$this->addFieldMapping('comment_body:format')
->defaultValue('full_html');
/*$this->addFieldMapping('uid', 'accountid')
->sourceMigration('WineUser')
->defaultValue(1); */
//optional
//$this->addFieldMapping('tid', 'category_id');
//$this->addFieldMapping('comment_count', 'hits');
// Unmapped destination fields
$this->addUnmigratedDestinations(array('uid', 'thread', 'mail', 'homepage', 'language', 'comment_body:language'));
$this->addUnmigratedSources(array('category_id'));
and is my destination correct? here it is:
$this->destination = new MigrateDestinationComment('comment');
based on my code only the comment table is mapped, i just assumed that the body and its revision will automatically map too like in my migration of nodes.
Help please