I am trying to write custom migrations to migrate my Drupal 7 website to Drupal 8. I am currently using Drupal 8.6.7 and Drupal 7.61 for a copy of the production website.
So far I have set up the D8 website with composer (docroot is path/to/web) (https://www.drupal.org/docs/develop/using-composer/using-composer-to-manage-drupal-site-dependencies )
I have always used Drush for maintenance actions on the D7 site and I am using Drush 9 for most of the actions including the migrations on the D8 site.
I have installed the most relevant modules in the D8 site so that I can start the migration, most notably all the D8 equivalents of the modules I used in the text formats/filters as well as migrate_plus, migrate_tools and migrate_upgrade.
The migration files are generated with the Drush command:
drush @dev migrate-upgrade "$LEGACYDB" "$LEGACYURL" --configure-only --migration-prefix=osn_custom_
So far I have successfully migrated the users and their roles so I have some knowledge on how migrations work.
The problem I am currently working on is the migration of a custom content type called 'classified'. This type has a default Drupal 7 body field and a field 'field_image'. So quite ordinary.
When I use the default generated migration file, it looks like everything is migrated, but the text is not visible. After research I found this is caused by the fact that the input format is set to the D7 code (in my case 2 aka 'full html') while there is no filter code in D8 that is called '2'. (src: https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#d7_to_d8 ).
I decided that I might as well convert 2 to 'basic html' and use the D8 configuration and not migrate the D7 text filters at all.
I created a migration lookup plugin with a static map that converts all D7 codes to the preferred D8 code. It might work well, but I am running into the problem that I can't get the migration plugin to work with the migration of the 'classified' migration configuration. So I decided to simplify it and set the format to a default value 'basic_html'.
Here is what I tried in the migrate_plus.migration.osn_custom_d7_node_classified.yml
The code snippets below only show the body configuration, because the other field configurations are generated with the drush command and not altered.
body: body
the default. Content is migrated, input format is set to '2'.
According to this: https://www.drupal.org/docs/8/api/migrate-api/migrate-process-plugins/migrate-process-overview#nested
and this: https://www.phase2technology.com/blog/drupal-8-migrations
it should be done like this:
'body/format':
plugin: default_value
default_value: basic_html
'body/value': body
However, this results in the following error:
[error] InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in /path/to/dev/web/core/lib/Drupal/Core/Database/Connection.php).
[error] Placeholders must have a trailing [] if they are to be expanded with an array of values. (/path/to/dev/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:783)
I have no clue what is wrong and what I should do instead. I also don't know how to debug this to find out what it's expecting.
Can someone please give me some pointers?