You are here

public function Migration::prepareKey in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 includes/migration.inc \Migration::prepareKey()

Default implementation of prepareKey. This method is called from the source plugin immediately after retrieving the raw data from the source - by default, it simply assigns the key values based on the field names passed to MigrateSQLMap(). Override this if you need to generate your own key (e.g., the source doesn't have a natural unique key). Be sure to also set any values you generate in $row.

Parameters

array $source_key:

object $row:

Return value

array

File

includes/migration.inc, line 1014
Defines the base class for import/rollback processes.

Class

Migration
The base class for all import objects. This is where most of the smarts of the migrate module resides. Migrations are created by deriving from this class, and in the constructor (after calling parent::__construct()) initializing at a minimum the name,…

Code

public function prepareKey($source_key, $row) {
  $key = array();
  foreach ($source_key as $field_name => $field_schema) {
    $key[$field_name] = $row->{$field_name};
  }
  return $key;
}