Skip to content

Instantly share code, notes, and snippets.

@edysmp
Last active January 22, 2016 17:09
Show Gist options
  • Save edysmp/24f0a13c3d4834dbe514 to your computer and use it in GitHub Desktop.
Save edysmp/24f0a13c3d4834dbe514 to your computer and use it in GitHub Desktop.
lookupDestinationId
/**
* Retrieves the hash of the source identifier values.
*
* @param array $source_id_values
* The source identifiers
*
* @return string
* An hash containing the hashed values of the source identifiers.
*/
protected function getSourceIDsHash(array $source_id_values) {
// When looking up the destination ID we require an array with both the
// source key and value, e.g. ['nid' => 41]. In this case, $source_id_values need to be ordered the same
// order as $this->sourceIdFields(). However, the Migration process
// plugin doesn't currently have a way to get the source key so we presume
// the values have been passed through in the correct order.
if (!isset($source_id_values[0])) {
$source_id_values = array_intersect_key($source_id_values, $this->sourceIdFields());
}
return hash('sha256', serialize(array_map('strval', array_values($source_id_values))));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment