Score:1

Help with migration needed - entity_lookup of multiple taxonomy references

ke flag

I am trying to fetch nodes with multiple taxonomy references from Drupal 9 instance A to instance B. B already has the vocabulary terms, so i want to use entity_lookup in the process for this field to get the correct ids on B. The vocabularies on A and B have slightly different names (A: 'schulstufe' B: 'schulstufen')

My YAML:

item_selector: data/
source:
  fields:
    -
      name: school_levels
      label: 'School Levels'
      selector: /relationships/field_level

process:
  # does not work yet
  field_school_school_levels:
    plugin: sub_process
    source: school_levels
    process:
      target_id:
        plugin: entity_lookup
        entity_type: taxonomy_term
        bundle: schulstufen
        bundle_key: vid
        value_key: name

Source example from --migrate-debug output:

"school_levels" => array:2 [
  "data" => array:2 [
     0 => array:3 [
       "type" => "taxonomy_term--schulstufe"
       "id" => "b20f2930-b5bf-42c6-9a9a-4f701fbbf1ca"
       "meta" => array:1 [
         "drupal_internal__target_id" => 28
       ]
     ]
     1 => array:3 [
       "type" => "taxonomy_term--schulstufe"
       "id" => "404b35fb-ed2a-4f48-965f-7b88acab98d2"
       "meta" => array:1 [
         "drupal_internal__target_id" => 33
       ]
     ]
   ]

Destination example from --migrate-debug output:

"field_school_school_levels" => array:2 [
    "data" => []
    "links" => []
  ]

I went through all the explanations i could find, including https://git.drupalcode.org/project/migrate_plus/blob/HEAD/src/Plugin/migrate/process/EntityLookup.php but i have no clue what my mistake is. This must be a very common migration task, so i hope somebody here can help!

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.