Entity lookup should support skipping field type check

Created on 19 July 2023, over 1 year ago
Updated 29 November 2023, 12 months ago

Problem/Motivation

The entity lookup plugin assumes that bundle type will exist and if it doesn't it tries to use introspection to determine bundle type from the active field type, this works fine for the 3 field types that are supported but if you have a field type that isn't one of those 3 you are out of luck even if you know what you are doing and you know all you need is the entity id returned. The entity lookup plugin should be able to return the id it found even if the bundle isn't defined and and field type isn't supported.

Steps to reproduce

  1. Setup a site with the user entity defined and the groups module enabled.
  2. Activate a group membership (aka relationship in Groups 3.x) on any group type
  3. Attempt to write a migration that has an entity_lookup on the entity_id field
  4. Notice that the group_relationship_target field type is not supported

Proposed resolution

Add an option to skip the field type check so that the entity id is able to be returned regardless of bundle being defined and regardless on if it is a "supported" field type

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Closed: won't fix

Version

6.0

Component

Plugins

Created by

πŸ‡ΊπŸ‡ΈUnited States ccjjmartin Austin, TX

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

Comments & Activities

  • Issue created by @ccjjmartin
  • πŸ‡ΊπŸ‡ΈUnited States ccjjmartin Austin, TX

    Adding patch and MR.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    195 pass
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    195 pass
  • @ccjjmartin opened merge request.
  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    Following this issue. An alternative approach would be to let us add to a list of EntityReferenceItem subclasses that can also be supported. Via hook, event, or whatever

  • Status changed to Closed: won't fix 12 months ago
  • heddn Nicaragua

    The introspective approach to identify the destination entity type and value key is a nice-to-have feature for some well known field types. It is just as easy to manually put in the values to the process plugin directly Or extend the EntityLookup class and set the values and do the extra lifting in the extension. I have consistently considered the entity lookup process plugin is feature complete for several years.

Production build 0.71.5 2024