Unverified Commit 30d14f9c authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2974274 by mitrpaka, RumyanaRuseva, joachim: exception message for...

Issue #2974274 by mitrpaka, RumyanaRuseva, joachim: exception message for unrecognized source IDs in lookupDestinationIds() should have more detail

(cherry picked from commit aa577bef)
parent c490e402
Loading
Loading
Loading
Loading
+1 −1
Changes for core/modules/migrate/src/Plugin/migrate/id_map/Sql.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -584,7 +584,7 @@ public function lookupDestinationIds(array $source_id_values) {

    if (!empty($source_id_values)) {
      $var_dump = var_export($source_id_values, TRUE);
      throw new MigrateException(sprintf("Extra unknown items in source IDs: %s", $var_dump));
      throw new MigrateException(sprintf("Extra unknown items for map %s in source IDs: %s", $this->mapTableName(), $var_dump));
    }

    $query = $this->getDatabase()->select($this->mapTableName(), 'map')
+2 −2
Changes for core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -529,14 +529,14 @@ public function testLookupDestinationIds() {
      $this->fail('Too many source IDs should throw');
    }
    catch (MigrateException $e) {
      $this->assertEquals("Extra unknown items in source IDs: array (\n  0 => 3,\n)", $e->getMessage());
      $this->assertEquals("Extra unknown items for map migrate_map_sql_idmap_test in source IDs: array (\n  0 => 3,\n)", $e->getMessage());
    }
    try {
      $id_map->lookupDestinationIds(['nid' => 1, 'aaa' => '2']);
      $this->fail('Unknown source ID key should throw');
    }
    catch (MigrateException $e) {
      $this->assertEquals("Extra unknown items in source IDs: array (\n  'aaa' => '2',\n)", $e->getMessage());
      $this->assertEquals("Extra unknown items for map migrate_map_sql_idmap_test in source IDs: array (\n  'aaa' => '2',\n)", $e->getMessage());
    }

    // Verify that we are looking up by source_id_hash when all source IDs are