0

Im using the code below to migrate a taxonomy term with multiple values and I get this error below. is there a way to migrate multiple taxonomy terms with this plugin? :

InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in [error] /var/www/html/docroot/core/lib/Drupal/Core/Database/Connection.php:744

field_states_operating_in:
    - plugin: entity_lookup
      source: field_states_operating_in
      entity_type: taxonomy_term
      value_key: name
      bundle_key: vid
      bundle: states_operating
2
+300

The field that you're migrating has multiple values and you're trying to run entity_lookup as though it has only one. I think you just need to make sure you're iterating over the values with the sub_process plugin.

Using this issue post as a reference, along with the docs for entity_lookup:

field_farbzuordnung:
    plugin: sub_process
    source: field_farbe
    process:
        target_id:
        plugin: entity_generate
        source: value
        value_key: name
        bundle_key: vid
        bundle: alle_farben
        entity_type: taxonomy_term
        ignore_case: true

...I think you'd want to do something like

field_states_operating_in:
    -
      plugin: sub_process
      source: field_states_operating_in
      process:
        target_id:
          plugin: entity_lookup
          source: target_id
          entity_type: taxonomy_term
          bundle: states_operating
          bundle_key: vid
          value_key: target_id

I'm not entirely sure that the source and value_key are correct but I think this should get you most of the way there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.