- 🇺🇸United States smustgrave
This seems like something that could still be useful. Could someone confirm?
I'd like to introduce the EntityTypeAwareInterface that brings two methods: getEntityType()
and getEntityInfo()
.
The goal of this is having a natural object oriented API which allows, whenever we are working with any entity controller or entity object to fetch the entity type and info easily.
One use case where it could be useful is there: #1781372: Add an API for listing (configuration) entities → . Having this would avoid "entity type" and "entity storage" parameters duplication, because the storage is supposed to know on which entity type it works.
I wrote a simple patch, that make all of EntityStorageControllerInterface
, EntityInterface
and EntityFormControllerInterface
implementing this new EntityTypeAwareInterface
interface.
Also wrote an abstract base class, and used it in every of the default implementations. I manually tested and right now it works gracefully when working with nodes, comments and taxonomy tags.
Ideally, this goes into the direction of injecting the entity info (eventually materializing it as an object/interface too) instead of letting all those objects doing direct global state procedural calls. The idea behind this is in the mid-term getting rid of the procedural API calls in the object oriented code.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
This seems like something that could still be useful. Could someone confirm?