Drupal 8 将分类法引用字段迁移到实体引用

Drupal 8 将分类法引用字段迁移到实体引用,drupal-8,configuration-files,taxonomy,paragraph,entityreference,Drupal 8,Configuration Files,Taxonomy,Paragraph,Entityreference,我正在尝试将附加到字段集合实体类型(Drupal 7)的分类法引用字段迁移到附加到段落实体类型(Drupal 8.6)的实体引用字段 虽然这似乎是迁移时要做的基本任务之一,但我找不到一个关于如何做的明确参考 id: d7_field_collection_field_name label: My Field name migration_tags: - Drupal 7 migration_group: migrate_drupal_7 source: plugin: d7_custo

我正在尝试将附加到字段集合实体类型(Drupal 7)的分类法引用字段迁移到附加到段落实体类型(Drupal 8.6)的实体引用字段

虽然这似乎是迁移时要做的基本任务之一,但我找不到一个关于如何做的明确参考

id: d7_field_collection_field_name
label: My Field name
migration_tags:
  - Drupal 7
migration_group: migrate_drupal_7

source:
  plugin: d7_custom_source_plugin
process:
  field_title:
    plugin: get
    source: field_title
  field_job_category:
    plugin: get
    source: field_job_category
destination:
  plugin: 'entity_reference_revisions:paragraph'
  default_bundle: my_paragraphs_bundle
migration_dependencies:
  required:
    - upgrade_d7_field
    - upgrade_d7_node_type
    - upgrade_d7_field_collection_type
    - upgrade_d7_field_instance
迁移过程如下所述:

因此,字段\作业\类别不起作用。我在处理插件的过程中尝试了很多方法,但运气不好。例如,我使用:

  field_job_category:
    plugin: migration_lookup
    migration: upgrade_d7_taxonomy_term_job_categories
    source: term_id
然后尝试使用源代码,因为我使用的是Drupal 8.6

  field_job_category:
    plugin: migration_lookup
    migration: upgrade_d7_taxonomy_term_job_categories
    sources:
      upgrade_d7_taxonomy_term_job_categories:
        - term_id
我相信这是field_job_类别下的一个配置错误,但我还没弄清楚


非常感谢你的帮助

通过做两件事解决了这个问题

首先,为我的字段使用sub_进程进程插件

field_job_category:
  -
    plugin: sub_process
    source: field_job_category
    process:
      target_id: tid
最后,实现hook\u migrate\u prepare\u row()以提供具有正确结构的数据,供上述子进程使用

$row->setSourceProperty($field_name, $new_value);
而$new_值应该是

Array
(
  [0] => Array
    (
        [tid] => Term ID
    )
 )
希望这有帮助!干杯