You are here

public function Sql::getRowBySource in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::getRowBySource()

Retrieves a row from the map table based on source identifier values.

Parameters

array $source_id_values: The source identifier keyed values of the record, e.g. ['nid' => 5].

Return value

array The raw row data as an associative array.

Overrides MigrateIdMapInterface::getRowBySource

File

core/modules/migrate/src/Plugin/migrate/id_map/Sql.php, line 428
Contains \Drupal\migrate\Plugin\migrate\id_map\Sql.

Class

Sql
Defines the sql based ID map implementation.

Namespace

Drupal\migrate\Plugin\migrate\id_map

Code

public function getRowBySource(array $source_id_values) {
  $query = $this
    ->getDatabase()
    ->select($this
    ->mapTableName(), 'map')
    ->fields('map');
  foreach ($this
    ->sourceIdFields() as $field_name => $source_id) {
    $query
      ->condition("map.{$source_id}", $source_id_values[$field_name], '=');
  }
  $result = $query
    ->execute();
  return $result
    ->fetchAssoc();
}