TransWikia.com

Migration with default values in the yml file

Drupal Answers Asked by webuser57 on December 10, 2021

has the following value:

  1. Firma
  2. Landwirtschaft
  3. Auto
  4. Stadt
  5. Traktor
  6. Straße
  7. Wald
  8. Wiese
  9. Park
  10. Felder

The 10 values should be imported into Drupal, version 8.
In order not to have to read out these 10 terms from the database, I would like to "write these values into a YML import file" and import them that way.
How can you do that?

Here is the first draft of the YML file:

id: k1_import
label: 'Daten import'
migration_group: k1_migration
source:
  plugin: k1import
  key: migration_k1
process:
  title: Firma
  title: Auto
…

One Answer

got a tip from a friend, here are the links:

https://api.drupal.org/api/drupal/core%21modules%21migrate%21src%21Plugin%21migrate%21source%21EmbeddedDataSource.php/class/EmbeddedDataSource/9.0.x

https://www.drupal.org/docs/8/api/migrate-api/migrate-destination-plugins-examples/migrating-users

Here's my solution, in a nutshell, begin of the YML file:

id: k1_import
label: 'Daten import'
migration_group: k1_migration
source:
  plugin: embedded_data
  data_rows:
    - 
        name_id: 1
        name: Firma
    -
        name_id: 2
        name: Landwirtschaft
    -
        name_id: 3
        name: Auto
    -
        name_id: 4
        name: Stadt
   ids:
     name:
          type: string
process:
    name: name
destination:
  plugin: 'entity:taxonomy_term'
  default_bundle: daten_import

End of the YML file.

Answered by webuser57 on December 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP