Closed (fixed)
Project:
Migrate
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Nov 2011 at 11:27 UTC
Updated:
14 May 2013 at 01:03 UTC
Jump to comment: Most recent
Comments
Comment #1
Andrey Zakharov commentedimplement method YourMigration::prepareRow
Comment #2
alanburke commentedThanks Andrey!
I implemented a cleanup function in my base class
and I call that within prepare_Row for each migration.
Comment #4
drclaw commentedI don't think this solution works anymore... I'm using migrate-7.x-2.5 and I'm still getting fields populated with empty values. (e.g.
$node->field_name['und'][0]['value'] == 0). I took a look at Migration::applyMappings() and it looks like the destination object has a field value set regardless of whether or not it's corresponding source field is set. I could be wrong though... has anyone else got this method above to work?Comment #5
chrisakeley commentedThis solution did not work for me, either. Even when using unset() in prepareRow, migrate created blank rows in the field_data_XX table for text fields. It looks like using removeFieldMapping DOES work, however. For example:
if (!strlen($row->my_text_field) $this->removeFieldMapping('my_text_field');Comment #6
drclaw commentedAh, I see. Thanks for mentioning that!
Comment #7
mikeryanPlease don't reopen long-closed issues - look for a relevant open issue (consider if #1792894: Set configured defaults for empty fields applies) or open a new issue.
Thanks.
Comment #8
ronino commentedNone of the above solutions works for me with version 2.5. What works for me instead in prepareRow() is to assign an empty array to those fields:
Comment #9
pmkanse commentedThanks @Ronino, it works!!!!