0

I am following the instruction on this page : https://www.drupal.org/project/migrate_file_to_media/issues/3118471 , but with media of bundle document, not image. I have my step 1 yml on this issue How can i debug why files are not being created when using migrate files to media module? My nodes of type grants and step 1 files are being created as media correctly, however when i do step 2, using the yml below, I get this error :

Missing bundle for entity type node (/var/www/html/docroot/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:108)

id: migd8_grants_media_step2
label: grants Media Mapping
migration_group: cncs
source:
  key: migrate
  plugin: d7_node
  node_type: grants

destination:
  plugin: entity:node

process:
  nid: nid
  changed: changed
  
  field_files:
    plugin: file_id_lookup
    source: field_files
    migration: migd8_grants_media_step1
    no_stub: true

migration_dependencies:
  optional:
  - migd8_node_grants
  - migd8_grants_media_step1

I made some changes as an experiment and started getting duplicate grants being created, one with the correct media files attached, and one without , these are the changes i made which caused the duplicates with one having the correct file attached:

id: migd8_grants_media_step2
label: grants Media Mapping
migration_group: cncs
source:
  key: migrate
  plugin: d7_node
  node_type: grants

destination:
  plugin: entity:node

process:
  nid: nid
  changed: changed
  title: title
  type:
    plugin: default_value
    default_value: grants
  field_files:
    plugin: file_id_lookup
    source: field_files
    migration: migd8_grants_media_step1
    no_stub: true

migration_dependencies:
  optional:
  - migd8_node_grants
  - migd8_grants_media_step1
4
  • Does the content type grants exist in both, the D7 and the D8 site? Seems like perhaps it doesn't exist on one of the sites.
    – No Sssweat
    Oct 7 '20 at 21:24
  • Hmmm in D7 & D8 edit the Grants content type and check that the machine name is indeed grants for both. Also check that in D8 the files field has a field type of entity reference (which should be referencing Media) and its not a field type of file.
    – No Sssweat
    Oct 8 '20 at 3:16
  • The field names are correct , I made some changes and i started getting duplicate grants, one with the files attached correctly and the other without . i put the yml that i made that causes those duplicates in the description above, one with the correct media attached. how can i get that result without the duplicates?
    – Diana
    Oct 8 '20 at 12:31
  • actually the source in the original migration is a plugin : source: plugin: migd8_node_grants does that make a difference?
    – Diana
    Oct 8 '20 at 13:01
1

in step2 i had to change it to this

destination:
  plugin: entity:node
  default_bundle: grants

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.