entity_generate result is ignored when the entity already exists

Created on 11 April 2019, about 5 years ago
Updated 25 August 2021, almost 3 years ago

Hello,

I am using entity_generate to migrate a D6 text field (with multiple values) to a D8 taxonomy.
Here is an extract of my config:

source:
  plugin: d6_node
  node_type: evenement
  track_changes: true
process:
  title: title
  field_types:
    plugin: entity_generate
    source: field_type_actu
    value_key: name
    bundle_key: vid
    bundle: types_d_evenements
    entity_type: taxonomy_term
    ignore_case: true
destination:
  plugin: 'entity:node'
  default_bundle: evenement
  no_stub: true

This works perfectly the first time I run the migration. But if I run it again with --update, the field_types field becomes empty.

I had a look at what EntityGenerate::transform() returns and there is a difference.
When it creates the entity, it simply returns its ID: "1058"
But when the entity already exists, it returns the ID in an array:

array:1 [
  0 => "1058"
]

(I assume the destination plugin does not like this format.)

The attached patch seems to be enough to work around my specific problem. (I have not tested it with other configurations.)

PS: I also tried the solution mentioned here β†’ but it does not work for me (the terms are not created at all).

πŸ› Bug report
Status

Active

Version

4.1

Component

Plugins

Created by

πŸ‡«πŸ‡·France prudloff Lille

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024