I've got a simple Text field which allows 2 values, let's call it field_text. My source database has two columns, let's say text1 and text2.

I want to set my migrate field mapping so that text1 is used as the first value for field_text and use text2 as the second value for field_text.

In other words, something like this:

$this->addFieldMapping('field_text[0]', 'text1');
$this->addFieldMapping('field_text[1]', 'text2');

1 Answer 1


You should implement prepareRow() method in your migration class. Inside prepareRow() you can read both source fields and add them to an array. I will provide an example:

public function prepareRow($row) {
  $row->text1 = array($row->text1, $row->text2);

Now your source field "text1" will contain both values and it can be mapped to "field_text". "text2" has to be set to DNM (do not map).

  • Does this same approach work for date fields that have a beginning and an end? I can't get it to work... Mar 10, 2013 at 22:30
  • Date fields are a different story. Take a look at migrate_extras.
    – ermannob
    Mar 14, 2013 at 17:13
  • This did the trick for me: drupal.org/node/1806296 But thanks for your reply :) Mar 14, 2013 at 17:21

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.