Migrate CSV files using intermediary SQL tables

Using migrate-7.x-2.6-RC1.

Motivation

Have you ever had a problem that certain rows in the CSV files used for Migration were empty, or didn't
need to be imported because of bogus data / empty fields?

Or maybe your CSV data is de-normalised and you want to skip certain rows that would
map to the same entities, but because of the skipping, your migration always shows
Incomplete Migration? Isn't that annoying? Especially if there are other dependent migrations
on the incomplete one, which won't run unless executed with --force.

Import new users and their Profile2 fields from one CSV file

This Cookbook shows, how you import one CSV file into a Drupal 7 site, creating new users, each with Profile2 fields.

The trick is to create two separate migrations from one source. The first creates the users, the second creates the profiles.

The second migration connects up the profiles it creates with the users that now exist by mapping the source unique key, MID, to the user uid. This is achieved by applying the line
$this->addFieldMapping('uid', 'MID')
to the code.

Remark
The intention of this cookbook is, with detailed notes on this page and comments in the code to explain the function of each component of this migration as a working demo. For your first try use a fresh installed 'drupal 7 with default profile' and then start with step 1.

Subscribe with RSS Subscribe to RSS - MigrateSourceCSV