0

I am 90% done with my migration from D6 to D7. The last thing to figure out is how to map a table in certain nodes, created with the tablefield module in D6, into a table in D7, also created with tablefield. Just mapping the fields does not do the trick.

$this->addFieldMapping('field_D7_table', 'field_D6_table');

With the above mapping there are no error messages, the table is just empty after the migration. I can see that the data is stored in serialized form in the legacy database. Can anyone point me in the right direction?

0

Tablefield does not currently include migration support - there is a patch to add it at https://www.drupal.org/node/2317245. If you try out the patch and report on your results there, you may help move it forward.

4
  • After applying the patch I added a row in my hook_migrate_api for the new tablefield fieldhandler (MigrateTableFieldHandler) and then it was possible to map the fields as usual. In my specific case I have to deal with the fact that the D6 tablefield module was modified to have draggable rows and only 2 columns, so I still have some work to do before I can use it though. – TBJ Mar 20 '16 at 18:20
  • I shoud add too, that it was possible to migrate the tablefield content with a simple "prepare()" function, without the patch: 'public function prepare($entity, $row) { if(!empty($row->field_D6_field[0])){ $entity->field_D7_field['und'][0]['value'] = $row->field_D6_field[0]; }' – TBJ Mar 20 '16 at 18:21
  • Interesting. I haven't used tablefield before myself, so don't know whatever special internal structure the field arrays may have, but from that (given that Migrate's default field handler assumes a 'value' default key) I would have expected a simple $this->addFieldMapping('field_D7_field', 'field_D6_field'); to work. – Mike Ryan Mar 21 '16 at 19:56
  • Yes, after applying the patch the simple mapping you suggest works fine. – TBJ Mar 23 '16 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.