You are here

public function Sql::getSourceIdsHash in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::getSourceIdsHash()
  2. 10 core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::getSourceIdsHash()

Retrieves the hash of the source identifier values.

@internal

Parameters

array $source_id_values: The source identifiers

Return value

string An hash containing the hashed values of the source identifiers.

7 calls to Sql::getSourceIdsHash()
Sql::delete in core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
Deletes the map and message entries for a given source record.
Sql::deleteDestination in core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
Deletes the map and message table entries for a given destination row.
Sql::getMessages in core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
Retrieves a traversable object of messages related to source records.
Sql::getRowBySource in core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
Retrieves a row from the map table based on source identifier values.
Sql::lookupDestinationIds in core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
Looks up the destination identifiers corresponding to a source key.

... See full list

File

core/modules/migrate/src/Plugin/migrate/id_map/Sql.php, line 203

Class

Sql
Defines the sql based ID map implementation.

Namespace

Drupal\migrate\Plugin\migrate\id_map

Code

public 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_keyed = [];
    foreach ($this
      ->sourceIdFields() as $field_name => $source_id) {
      $source_id_values_keyed[] = $source_id_values[$field_name];
    }
    $source_id_values = $source_id_values_keyed;
  }
  return hash('sha256', serialize(array_map('strval', $source_id_values)));
}