I'm trying to import a CSV File into Content Types and Paragraphs, using Migrate module (and mainly this tutorial : https://mtech-llc.com/blog/charlotte-leon/migration-csv-data-paragraphs).
For this I have created a custom module in modules/custom, and I added the .yml files in config/install.
Here's my two .yml (produit_epargne is for the Content Type, and epargne_support is for the Paragraph) :
dependencies:
enforced:
module:
- produit_migration
id: produit_epargne
migration_group: produit_group
source:
plugin: csv
path: public://csv/test_import_csv_migrate.csv
ids:
[id]
header_row_count: 1
delimiter: ';'
fields:
-
name: id
label: id
-
name: title
label: title
-
name: field_referent
label: field_referent
-
name: field_fiches_gamme
label: field_fiches_gamme
-
name: field_date_mise_a_jour
label: field_date_mise_a_jour
process:
title: title
field_referent: field_referent
field_fiches_gamme: field_fiches_gamme
field_date_mise_a_jour:
plugin: format_date
from_format: Y-m-d
to_format: Y-m-d
source: field_date_mise_a_jour
field_supports/target_id:
-
plugin: migration_lookup
migration: epargne_supports
no_stub: true
source: id
-
plugin: extract
index:
- '0'
field_supports/target_revision_id:
-
plugin: migration_lookup
migration: epargne_supports
no_stub: true
source: id
-
plugin: extract
index:
- 1
destination:
plugin: 'entity:node'
default_bundle: produit_epargne
migration_dependencies:
required:
- epargne_support
optional: { }
dependencies:
enforced:
module:
- produit_migration
id: epargne_support
migration_group: produit_group
source:
plugin: csv
path: public://csv/test_import_csv_migrate.csv
header_row_count: 1
delimiter: ';'
ids:
[id]
fields:
-
name: id
label: id
-
name: field_nb_fonds_euros
label: field_nb_fonds_euros
-
name: field_nb_fonds_thematiques
label: field_nb_fonds_thematiques
-
name: field_nb_support_fcpe
label: field_nb_support_fcpe
-
name: field_nb_support_uc
label: field_nb_support_uc
process:
field_nb_fonds_euros: field_nb_fonds_euros
field_nb_fonds_thematiques: field_nb_fonds_thematiques
field_nb_support_fcpe: field_nb_support_fcpe
field_nb_support_uc: field_nb_support_uc
destination:
plugin: 'entity_reference_revisions:paragraph'
default_bundle: epargne_supports
migration_dependencies:
required:
- files
optional: { }
But I have two major issues :
- First, the migration group produit_group is not recognized when I run :
drush migrate:imports --group produit_group
which is probably the source of the second issue
- Second, when I run
drush migrate:imports produit_epargne
, it only creates the content types withtout the paragraphs linked to it.
Does anybody see the problem in my code / configuration ?