function Sql::getRowByDestination
Same name in other branches
- 9 core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::getRowByDestination()
- 8.9.x core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::getRowByDestination()
- 10 core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::getRowByDestination()
Overrides MigrateIdMapInterface::getRowByDestination
File
-
core/
modules/ migrate/ src/ Plugin/ migrate/ id_map/ Sql.php, line 553
Class
- Sql
- Defines the sql based ID map implementation.
Namespace
Drupal\migrate\Plugin\migrate\id_mapCode
public function getRowByDestination(array $destination_id_values) {
$query = $this->getDatabase()
->select($this->mapTableName(), 'map')
->fields('map');
foreach ($this->destinationIdFields() as $field_name => $destination_id) {
if (!isset($destination_id_values[$field_name])) {
return [];
}
$query->condition("map.{$destination_id}", $destination_id_values[$field_name], '=');
}
$result = $query->execute()
->fetchAssoc();
return $result ? $result : [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.