Support nested lookup key in EntityLookup and EntityGenerate

Created on 8 July 2021, almost 3 years ago
Updated 22 February 2023, over 1 year ago

Problem/Motivation

Assume you are doing a migration where first images are imported and later you want to wrap those images into media entities.

The last stage would look like this:

  field_image/target_id:
    -
      plugin: migration_lookup
      migration: d7_image_migration
      source: 'field_image/0/fid'
    -
      plugin: skip_on_empty
      method: process
    -
      plugin: entity_generate
      value_key: field_media_image/target_id
      entity_type: media
      bundle_key: bundle
      bundle: image
      values:
        field_media_image/width: field_image/0/width
        field_media_image/height: field_image/0/height
        field_media_image/title: field_image/0/title
        field_media_image/alt: field_image/0/alt

The issue here is with the lookup key defined behind value_key as it does not allow to use separators right now and in order to even make it work one can only use the field name without the property (target_id), but in this case when the further properties under values are added they will override the target id as it wasn't nested.

Steps to reproduce

Support the row property separator and properly explode it and set nested properties in EntityLookup and EntityGenerate.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

✨ Feature request
Status

Needs work

Version

6.0

Component

API

Created by

πŸ‡©πŸ‡ͺGermany hchonov πŸ‡ͺπŸ‡ΊπŸ‡©πŸ‡ͺπŸ‡§πŸ‡¬

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

  • πŸ‡ͺπŸ‡ΈSpain akalam

    I think it was because the patch is for the 6.x branch and the pipeline was trying to apply it against the 5.x branch. I tried to re-test the patch against 6.x, it applies but now a test is failing

Production build 0.69.0 2024