Updating existing products via Drupal Migrate I have 2 migrate classes - ProductsNewMigrate and ProductsUpdateMigrate.

1) ProductsNewMigrate runs initially, adding products from a CSV file into Drupal.  I can confirm this works correctly, the new products are created and a migrate map is set up in the database.

2) ProductsUpdateMigrate is required to import another CSV (exactly the same structure as in 1.) but with the updated product data originally migrated via ProductsNewMigrate.  

I just can't get the Update migrate to work.
I receive the error: 
array_flip(): Can only flip STRING and INTEGER values

When looking at the migrate map table for this Migration - migrate_map_productsupdate..
I notice sourceid1 is set to the SKU - which is correct.  However, destid1 and destid2 (product_id and product_revision respectively) are both null values - which could be causing this? 

Edit: Also receive the warning message: "product_id" was used as destination field in "sku" mapping but is not in list of destination fields when viewing the migrate page!

See the code below:

Code:

class ProductsUpdateMigration extends CustomMigration {
  public function __construct() {
    parent::__construct();
    $this-&gt;description = t('Import new products from CSV');

    $csvfile = "/drupal/products_updated.csv";
    $columns = array(
      0 =&gt; array('sku', 'Product SKU'),
      1 =&gt; array('title', 'Product title'),
      2 =&gt; array('colour_specific', 'Product colour specific'),
      3 =&gt; array('price_group', 'Price Group'),
      4 =&gt; array('composition', 'Product Composition'),
      5 =&gt; array('width', 'Width'),
      8 =&gt; array('price', 'Product Price'),
    );

    $this-&gt;map = new MigrateSQLMap($this-&gt;machineName,
      array(
        'sku' =&gt; array(
          'type' =&gt; 'varchar',
          'length' =&gt; 255,
          'not null' =&gt; TRUE,
          'description' =&gt; 'SKU/newref',
          'alias' =&gt; 'p',
        )
      ),
      MigrateDestinationEntityAPI::getKeySchema('commerce_product')
    );
    $this-&gt;source = new MigrateSourceCSV($csvfile, $columns, array('header_rows' =&gt; 1));
    $this-&gt;destination = new MigrateDestinationEntityAPI('commerce_product', 'blinds');
    $this-&gt;systemOfRecord = Migration::DESTINATION;

    // print_r($this);

    // Mapped fields
    $this-&gt;addFieldMapping('product_id', 'sku')
      -&gt;sourceMigration('ProductsNew');
    $this-&gt;addFieldMapping('title', 'title');
    $this-&gt;addFieldMapping('commerce_stock')
      -&gt;defaultValue(5);
    $this-&gt;addFieldMapping('field_blinds_colour_specific', 'colour_specific');
    $this-&gt;addFieldMapping('field_blinds_composition', 'composition');
    $this-&gt;addFieldMapping('field_blinds_width', 'width');
    $this-&gt;addFieldMapping('commerce_price', 'price');
    $this-&gt;addFieldMapping('field_blinds_price_group', 'price_group');
    $this-&gt;addFieldMapping('type')
      -&gt;defaultValue('blinds');
  }

  public function prepareRow($current_row) {
    $colours = explode(';', $current_row-&gt;colour_specific);
    // // print '&lt;pre&gt;';
    // // print_r($colours);
    // // print '&lt;/pre&gt;';
    $current_row-&gt;colour_specific = $colours;
    // $current_row-&gt;migrate_map_destid1 = 62;
    // $current_row-&gt;migrate_map_destid2 = 67;
    print_r($current_row);
    return TRUE;
  }

  public function prepare($entity, stdClass $row) {
  }
}
Took a slightly different approach to solve this. 


Upgraded Migrate module from version 2.5 to 2.6
Ran upgrades drush updatedb, made sure the migration groups were registered (did this via migrate ui)
After reading the following articles regarding the new 'trackchanges' hash value option:
http://timonweb.com/using-hash-value-trackchanges-to-detect-source-data-changes-in-migrate-for-drupal-7
&amp; http://www.acquia.com/blog/migrate-26-framework-changes I now
applied the following to the migrate in step 1):

$this-&gt;source = new MigrateSourceCSV($csvfile, $columns, array(
  'header_rows' =&gt; 1,
  'track_changes' =&gt; 1
));



The use of track changes now allows the same CSV to be uploaded, any new rows will create a product. Any changes will be detected via the hash that this option provides in the migrate_map table - thus causing the particular product to be updated.