If you are trying to migrate to a NEW EMPTY Drupal 8 site from Drupal 7 and you have field collections that you want to see in Paragraphs, AND you would like to just use core Migrate (possibly with the Migrate Run module) and not have to use Migrate Plus or Migrate Tools, then you might give this setup a try.
These files are all that I required to get a migration of our field collections in Drupal 7 into our Drupal 8 content type with a paragraph field reference (place all of these into your custom migrate module directory, follow the paths outline in each):
- Custom module info file (migrate_custom.info.yml)
- Custom module file (migrate_custom.module (remove the .php - added that so gist would give it syntax coloring))
- Source plugin (src/Plugin/migrate/source/FCEntityMigrate.php)
- The migration plugin (migrations/custom_paragraph.yml)
This setup assumes the field name of your field collection in Drupal 7 is the same as the field name of the paragraph field in Drupal 8.
Create your custom migration module, place these things in the correct path structure (as listed) and change the following things within to match your paragraph, entity, and field names:
- "field_custom_paragraph_field" - change all instances of this string (including where it precedes "_value" or follows "field_data_") to the name of your paragraph field reference.
- "custom_paragraph" - change this in custom_parargraph.yml line 7 to the machine name of your paragraph entity.
- "custom_paragraph" - all other occurrences of this refer to the plugin name, such as line 12 of custom_paragraph.yml and line 13 of FCEntityMigrate.php.
- "migrate_custom" - this is the name of your module.
- "bundle" - change this to your entity type, such as in "drush mi d7_node:bundle"
I have included a start on node revisions, but did not actually test that part. It might work!
Lastly, make sure that any fields you want to migrate in your field collection are included in the migration plugin yml. If they aren't there, they will not migrate.
MANY THANKS to chx (Karoly Negyesi) for helping me stumble through all of the intricacies of this and soooo many other things.
It doesn't work for migration from Drupal7 to Drupal10. There are no errors but I got "No migrations found. " message after migration.
I remake query() function also: