I have successfully migrated nodes from a D9 source site into a a custom entity type (RedHen CRM contact) on a target D9 site.
Next, i am trying to migrate taxonomy terms with a multiple reference field from the source site into nodes of type 'networksn21' on the target site using the first migration. I am using the following yml file for the second migration:
source:
plugin: url
data_fetcher_plugin: http
data_parser_plugin: json
headers:
Accept: 'application/json; charset=utf-8'
Content-Type: 'application/json'
urls:
- https://www.source-site.ch/jsonapi/taxonomy_term/netzwerk
item_selector: data/
fields:
# ...other source fields...
-
# the multiple reference field on the source site
# inside the taxonomy term
name: coordinators
label: 'Coordinators'
selector: /relationships/field_coordination/data
process:
# ... other target fields ...
# target field, multiple references to entities of type redhen_contact
field_nwsn21_coord_contacts:
plugin: sub_process
source: coordinators
process:
target_id:
plugin: migration_lookup
# the previous migration into RedHen contacts:
migration: crm_mig_contacts_sn21
source: id # substituting 'target_id' here does not change outcome
migration_dependencies:
required:
- crm_mig_contacts_sn21
destination:
plugin: 'entity:node'
default_bundle: networksn21
The migration runs well for all simple fields but the references for the field_nwsn21_coord_contacts are not mapped at all (the target field remains empty)
If i run drush migrate:import crm_mig_networks_sn21 --migrate-debug, it displays the source array of references:
"coordinators" => array:2 [
0 => array:2 [
"type" => "node--kontakt"
"id" => "f5c235f1-fc0c-4755-bedf-59a5e294538f"
]
1 => array:2 [
"type" => "node--kontakt"
"id" => "eec9b19d-4162-44ad-8810-f1dfbbff3beb"
]
]
In the 'destination' debug output, it see:
"field_nwsn21_coord_contacts" => array:2 [
0 => array:1 [
"source" => "f5c235f1-fc0c-4755-bedf-59a5e294538f"
]
1 => array:1 [
"source" => "eec9b19d-4162-44ad-8810-f1dfbbff3beb"
]
]
The source keys and target ids are those i find in the migration mapping table and they are correct.
I do not have a real understanding of drupal migrate, just following some examples and the bits of documentation i could find on drupal.org. What do i do wrong? Any clues?