First of all an amazing module, and I have no words how helpful has the Migrate module been for us. We are importing flags from a live site into our dev, everything works fine except stuck with one thing at the moment.

$this->addFieldMapping('uid', 'uid')->sourceMigration(array('UserAccountsMigration'));

We are mapping the uid column of the source with the destination, and the uid column of the destination is based on the userMigration class name UserAccountsMigration. There are certain number of users which are exactly the same in live and dev environments, i.e their uids and emails, so they do not get mapped to the user_map_useraccountsmigration table, thus this like of code

$this->addFieldMapping('uid', 'uid')->sourceMigration(array('UserAccountsMigration')); skips those records with those uids which are already present in the db. How can I put condition field mapping or atleast make those already present uids map to the user_map_useraccountmigration table?

My general thought is that we may give default value as the following

$this->addFieldMapping('uid', 'uid')->sourceMigration(array('UserAccountsMigration'))->defaultValue(); but how to pass the source uid into it or if we can conditionally do field mapping like the following
if(sourceMIgration is empty)
$this->addFieldMapping('uid', 'uid');
else {
$this->addFieldMapping('uid', 'uid')->sourceMigration(array('UserAccountsMigration'));
}

Comments

Drupak created an issue. See original summary.

Drupak’s picture

Component: Documentation » Code
Category: Feature request » Support request
Priority: Normal » Major