You are here

public function MigrateSQLMap::getRowBySource in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 plugins/sources/sqlmap.inc \MigrateSQLMap::getRowBySource()

Retrieve a row from the map table, given a source ID.

Parameters

array $source_id:

Overrides MigrateMap::getRowBySource

File

plugins/sources/sqlmap.inc, line 271
Defines a Drupal db-based implementation of MigrateMap.

Class

MigrateSQLMap
@file Defines a Drupal db-based implementation of MigrateMap.

Code

public function getRowBySource(array $source_id) {
  migrate_instrument_start('mapRowBySource');
  $query = $this->connection
    ->select($this->mapTable, 'map')
    ->fields('map');
  foreach ($this->sourceKeyMap as $key_name) {
    $query = $query
      ->condition("map.{$key_name}", array_shift($source_id), '=');
  }
  $result = $query
    ->execute();
  migrate_instrument_stop('mapRowBySource');
  return $result
    ->fetchAssoc();
}