Successfully migrated public and private files to D9 system using core d7_file and d7_file_private migrations.
Now trying to migrate the file info into file fields (entity_reference_revisions:paragraph migration). My source plugin is generating the source fields, but nothing is being migrated to the file fields and there are no messages. All other fields are migrating successfully.
These are the two file fields in the paragraph entity into which I am trying to insert file info:
- field_private_files (file field)
- field_public_files (file field)
My source plugin (d7_agenda_section):
- does a migrate_lookup and gets the migrated file fids for this paragraph
- does a lookup in the source database and gets the source file description for each fid
- creates (using prepareRow()) both a private and public field each of which contains the file target_id and description in the following array format:
(  => Array ( [target_id] => 325 [description] => 3.C. Employment Chart (v4) )  => Array ( [target_id] => 339 [description] => 5.A. Nurse School Board Report )  => Array ( [target_id] => 340 [description] => 5.B. Board Calendar ) )
This is my migration code:
source: plugin: d7_agenda_section key: migrate langcode: en process: 'field_content/value': body_value 'field_content/format': body_format field_private_files: - plugin: skip_on_empty method: process source: private - plugin: sub_process process: target_id: target_id display: plugin: default_value default_value: 1 description: description field_public_files: - plugin: skip_on_empty method: process source: public - plugin: sub_process process: target_id: target_id display: plugin: default_value default_value: 1 description: description destination: plugin: entity_reference_revisions:paragraph default_bundle: agenda_section migration_dependencies: required: - sbn_migrations_d7_file - sbn_migrations_d7_file_private
I run the migration and the field_content is migrated, but nothing in field_public_files or field_private_files.
I am thinking my problem is with the skip_on_empty usage as I have used similar array field processing code successfully to migrate nested paragraphs:
field_body1: source: prepare_multiple_paragraphs plugin: sub_process process: target_id: target_id target_revision_id: target_revision_id
Some paragraphs will have public and private files, some will have none, others will have one or the other. I have read that there are problems with the sub_process plugin if the array is empty. So my goal here is to skip the field if it contains an empty array.
Looking for suggestions on how to resolve this.