0

I have below file of code for paragraph migration.

id: data
label: Import data.
migration_group: data_import
source:
  # Refer to data_import migration group.

destination:
  plugin: entity:node
  default_bundle: data

process:
  field_data:
    -
      plugin: skip_on_empty
      method: process
      source:
       - id
    -
      plugin: migration_lookup
      migration: paragraph_data_1
      no_stub: true
    -
      plugin: sub_process
      process:
        target_id: '0'
        target_revision_id: '1'
  # field_data/target_id:
  #   -
  #     plugin: migration_lookup
  #     migration: paragraph_data_1
  #     no_stub: true
  #     source: id
  #   -
  #     plugin: extract
  #     index:
  #       - '0'
  # field_data/target_revision_id:
  #   -
  #     plugin: migration_lookup
  #     migration: paragraph_data_1
  #     no_stub: true
  #     source: id
  #   -
  #     plugin: extract
  #     index:
  #       - '1'

migration_dependencies: {}

When I run it gives

TypeError: Argument 1 passed to Drupal\migrate\Row::__construct() must be of the type array, string given, called in /var/www/my-project/docroot/core/modules/migrate/src/Plugin/migrate/process/SubProcess.php on line 173 in Drupal\migrate\Row->__construct() (line 101 of /var/www/my-project/docroot/core/modules/migrate/src/Row.php).

Below is the code for migration group file

id: data_import
label: Data import migration group
description: data migration
source_type: csv
shared_configuration:
  source:
    plugin: csv
    path: 'public://import/data.csv'
    delimiter: ','
    enclosure: '"'
    header_row_count: 1
    keys:
      - id
    ids:
      id:
        type: string

Below is the content for data.csv

id,name,place_1,address_1
1,test,"test","test"
2,test1,"test","test"

Here place_1 & address_1 belongs to paragraph When I run migration script for paragraph it makes entry in respective table migrate_map_paragraph_XXX

  • 2
    One of the string values you've passed is supposed to be an array of values. – Jaypan Nov 20 '18 at 7:31
  • Hi @Jaypan I have added code for migration group. I have CSV file. – Julia Nov 20 '18 at 7:37
  • I'm sorry, I don't know which string is supposed to be an array, I was just giving some clarity on what the error message means, to hopefully give you a pointer in the right direction. – Jaypan Nov 20 '18 at 7:42
  • 1
    Can you provide source data csv? As Jaypan said, plugin: iterator need source is array. – MrD Nov 20 '18 at 8:02
  • I have added content for data.csv @MrD. iterator is deprecated so need to use sub_process – Julia Nov 20 '18 at 8:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.