When migrated translated entities, we will need multiple rows for a single entity, one per translation. Those rows need to be able to find each other, so that they can become parts of the same entity.
Eg: When migrating a translated term, we might have rows with source IDs:
|sourceid1 (tid)||sourceid2 (language)|
Somehow when the second row (2, fr) is imported, it has to find the entity created by the second row, so that it can add a translation instead of creating a brand new entity.
This will be necessary for i18n node migrations, see https://www.drupal.org/node/2225775#comment-11187483
Currently, one can query the ID map for the destination IDs, using all the source IDs:
$id_map->lookupDestinationId(['tid' => 2, 'langcode' => 'en']);
We can allow the destination to also query the id-map by a subset of source IDs, eg:
$id_map->lookupDestinationIdsSubset(['tid' => 2]);
This would return the set of destination ID values for the rows with the same source tid. Potentially multiple sets of destination ID values would be returned.
We could also add more migrations to solve this problem. We would have a d6_taxonomy_term migration that just migrated the default translation, and then a d6_taxonomy_term_translations migration that migrates the (multiple) translations. It could use a 'migration' process to lookup the entity that was created by the d6_taxonomy_term migration, so they would all be able to share the same ID.
This would have the downside of multiplying the migrations that we create. We'd need up to four migrations for a single content type: node, node_revision, node_translations, and node_revision_translations.
|Task||Novice task?||Contributor instructions||Complete?|
|Discuss what we want to do!|
|Create a patch||Instructions|
|Add automated tests||Instructions|
User interface changes
Add a lookupDestinationIdsSubset() method to MigrateIdMapInterface.
Data model changes
Probably none. But if we want to be able to query with strange source IDs, we may have to add more source-ID-hashes to the migrate map table, see https://www.drupal.org/node/2613878