Entity types w/o bundle key should not be able to define multiple bundles

Created on 28 August 2019, over 5 years ago
Updated 24 May 2023, over 1 year ago

Problem/Motivation

An entity type that has no bundle key (i.e. $entity_type->hasKey('bundle') === FALSE) is still able to expose multiple bundles, via hook_entity_bundle_info(). This is a logical nonsense. Not having a bundle key means: this entity type have no bundle (like the user entity type).

Proposed resolution

Don't allowhook_entity_bundle_info() (and hook_entity_bundle_info_alter()) to populate the bundle info list (see EntityTypeBundleInfo), with more than one entry which is the entity type ID itself, for such entity types.

Eventually consider deprecating such practice in the first step.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

TBD.

📌 Task
Status

Active

Version

9.5

Component
Entity 

Last updated 6 minutes ago

Created by

🇷🇴Romania claudiu.cristea Arad 🇷🇴

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.

  • 🇳🇱Netherlands Lendude Amsterdam

    This came up as a bug smash daily triage target. Discussed with @catch and we agreed that this is more a DX task than a bug, so moving this to task. If you feel that this logical nonsense leads to actual breaks of things the developer would expect to work, feel free to move this back to a bug.

Production build 0.71.5 2024