0

I have below migration script for paragraph migration, where I have 2 fields, (1) icon_type --> List(text) field type (2) icon_url --> Link field type

UPDATED WORKING CODE BELOW

If I run the migration script only icon_type is created but not the icon_url

id: icon_type_link
label: Icon Type Link
migration_group: devel
source:
 plugin: csv
 path: 'modules/custom/my_custom_module/data/icon_type_link.csv'
 keys:
   - id
 header_row_count: 1
destination:
 plugin: entity:paragraph
process:
 type:
      plugin: default_value
      default_value: icon_type_link
 uuid: uuid
 entity_id: entity_id
 icon_type: icon_type
 icon_url/uri: url
 icon_url/title: title
migration_dependencies: {}

1 Answer 1

0

I guess both icon_url and icon_type are fields of your paragraph entity. Remove the leading blanks in front of the line

icon_url:

until it has the same indentation level as icon_type.

(Whitespaces are very important in YAML: Indenting something blanks makes it a child of a previous line with less blanks. In your example icon_url has 2 blanks and therefor it is a sub value of field icon_type. With only one blank [same as icon_type and all the other fields] it means that icon_url is a direct child of the global process [the one without blanks].)

5
  • Yes icon_type and icon_url are is in same level, and YAML file is not showing any error.
    – Ashi
    Jul 31, 2018 at 6:05
  • Where is your icon_url source defined? Your icon_urldestination uses an icon_url source that isn't defined anywhere directly, and I don't know the CSV source plugin, but I don't think it a CSV source fields with sub values.
    – Hudri
    Jul 31, 2018 at 7:26
  • Thank You for your reply. This is my csv file data [ id,uuid,entity_id,icon_type,url,title 1,a7fdd984-c622-4d12-9888-308b4f032897,1,speaker-icon,google.com,Test Import ] What source I need to add here?
    – Ashi
    Jul 31, 2018 at 7:52
  • Completly remove the icon_url destination with iterate, this is only needed when dividing one source column into multiple destinations. Instead do something like target_field_name/sub_value_name: column_name_in_csv (every field sub value in its own line on the same level)
    – Hudri
    Jul 31, 2018 at 10:58
  • Thank you Hudri. Now I made the changes(as mentioned by you) which is updated above and now it is working fine.
    – Ashi
    Aug 1, 2018 at 13:02

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.