How to return a simple object on dynamic_entity_reference values

Created on 17 July 2024, 5 months ago
Updated 5 September 2024, 4 months ago

Problem/Motivation

In fields of type "dynamic_entity_reference" this module creates a Union of Entity types. This is many cases causes too complex results as also as errors.

Steps to reproduce

Enable Open Social module activity_creator and enable the entity type "activity" on "graphql_compose" (this needs a custom Class from GraphQLComposeEntityTypeBase of course).

Proposed resolution

For such complex Unions return the simple object of the value and not a Union like this:

"field_my" => [
  "x-default" => [
    0 => [
      "target_id" => "19",
       "target_type" => "node",
    ]
  ]
]

Remaining tasks

- Add an option on the UI to disable Union and display the simple array value
- OR find a method to override FieldType per field so it resolves to such a type and not as Union

โœจ Feature request
Status

Active

Version

2.2

Component

Code

Created by

๐Ÿ‡ฌ๐Ÿ‡ทGreece TheodorosPloumis Greece

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

Comments & Activities

  • Issue created by @TheodorosPloumis
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia almunnings Melbourne, ๐Ÿ‡ฆ๐Ÿ‡บ

    Can see the merit in wanting this specifically for Dynamic Entity Relationships.

    They can get a bit out of hand.

    I like your field type idea.

    Itโ€™s new behaviour compared to how everything else works, so we might need to introduce a specific setting for the field type.

    Specific settings for fields arenโ€™t currently really supported, so itโ€™s a good chunk of work to do it right.

    Perhaps we can introduce a settings object into the schema and attributes of the plugin. This could allow adhoc extra fields to be added to the config ui.

  • Assigned to almunnings
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia almunnings Melbourne, ๐Ÿ‡ฆ๐Ÿ‡บ
Production build 0.71.5 2024