I have a migration module that imports data from a CSV. I've steadily been adding code to the module and fields to the CSV, and it's always worked, albeit sometimes only after some work. But now there's one profile2 profile among the many I'm importing to in which the text fields don't get any data successfully imported to them. This happens even when I just put '1' or '0' for them in the CSV. Oddly, the non-text fields in the profile2 profile import fine, even though they're later in the CSV and the module code.

My question is how I go about debugging this. I couldn't find a 'how to debug Migrate' page in the documentation or on the web. I've found Migration::displayMessage, but what can I print via this to show what data's been mapped to these fields from the CSV? I just get the abstract mapping structure without any data from my CSV when I run Migration::displayMessage('<pre>'.print_r($this, TRUE).'</pre>', 'debug');

1 Answer 1


Answer from Mike Ryan: I usually run migrations in drush and, when not stepping through in a debugger, use drush_print_r(). The key points you want to instrument are prepareRow() (dump $row to make sure the source data is being pulled correctly in the first place) and prepare() (dump $node to make sure the source values are getting properly mapped into the node object that's about to be saved).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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