Problem/Motivation
There are three things that describe entities: \Drupal\Core\Entity\FieldableEntityInterface
, bundle_entity_type
and bundle_of
for config.
At the same time fields are bound to content entities via bundles only.
The problem is a bundle itself, the comment bundle is a pita and nice example what is the actual usage of bundle.
The bundle is "entity_type__field_name" (a bit fragile) but this is a relation pointing to both entities.
So bundle_of
does not work and I'd like to use bundle_entity_type
as someItemInterface
with carnality.
In perfect work bundle_of
is a "back-reference" calculated field (bye bye nodeReferrer
Proposed resolution
Re-think bundle_of
property to field. Allow bundle as calculated field.
Provide a kind of backReference field with core, maybe a views field could be used.
Write tests
Remaining tasks
tbd
User interface changes
tbd
API changes
tbd
Comments
Comment #1
Berdirbundle_keys no longer exists, that was something else (it was, how to get the bundle from the bundle object, only used by field_ui, no longer needed and dropped).
+1 to merging bundle_of and bundle_entity_type, those were added at almost the same time in different issues.
Don't understand the rest, also comment bundle might become a real entity too now.
Comment #2
andypostComment #4
cilefen CreditAttribution: cilefen commented@andypost Could you update the issue summary and maybe re-categorize if this is still needed?
Comment #5
andypostUpdated a bit
The issue mostly about
bundle_of vs bundle_entity_type
currently entities requires both to work properlyComment #6
andypostComment #7
cilefen CreditAttribution: cilefen commentedSo is this more of a task?
Comment #11
geek-merlinI don't get it completely, but
> In perfect work bundle_of is a "back-reference" calculated field
lives in #2497649: Implement Entity Reference Backreferences
Comment #18
claudiu.cristeaAlso, it would be nice if a bundle entity type can be used on more than one content entity. I have this use-case: I want to create a new content entity type by extending
taxonomy_term
. But I still want to usevocabulary
as bundle for the new entity type. Right now, asbundle_of
being a string (not array), I cannot do that.Comment #19
claudiu.cristeaI've created #3191814: Allow bundle entity to be used for more than one content entity for the idea from #18.