Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up to #2002134: Move TypedData metadata introspection from data objects to definition objects. Let's implement getting property definitions in the EntityDefinition class to cover the case of multiple defined bundles.
Comments
Comment #1
BerdirAnd how should that work exactly?
Definitions can vary by bundle, so which one do we prefer?
Comment #2
fubhy CreditAttribution: fubhy commentedI just ran across this problem while working on the GraphQL module trying to generate the Schema for entities and their bundles. Multiple bundles would make that REALLY awkward. I have no clue how that could possibly work.
Comment #7
Wim LeersNot only GraphQL is affected, also JSON API. Without this,
EntityDataDefinition
is basically useless.Comment #8
BerdirI still don't quite understand what exactly this is trying to achieve. As I said, the same field can for example have a different label or different field settings for different bundles. What would you want to display then? What is this needed for?
Comment #9
gabesullice@Berdir, speaking for the JSON API module: we operate on all fields (updating and normalizing) using the TypedData API. Generally, this would let us deal with both entities and fields more uniformly.
Specifically, this issue was brought back up because we would like to use DataDefinitionInterface::isInternal() for limiting access to "internal" entities rather than multiple implementations of module-specific hooks.
WRT bundle-specific fields,
Drupal\Core\Entity\Plugin\DataType\Deriver\EntityDeriver
derives types by bundle, with a data type like:entity:node:article
.Comment #10
BerdirI see, but afaik having isInternal() support on the entity-type level has nothing to do with this issue. As far as I understand, this is about having a single definition somehow for configurable fields across multiple bundle, but as I said, I don't really see how that would work or why it is major.
I'd suggest to open a separate issue for the isInternal() thing.
Comment #11
Wim LeersSee #2932035-17: ResourceTypes should be internal when EntityType::isInternal is TRUE by @gabesullice.
Comment #12
Wim LeersI guess it's not clear what this issue is about exactly. So let's fix that.
Comment #13
gabesulliceUpdated the IS and issue title.
Comment #14
BerdirI still don't think that's the same issue and a separate new issue would make more sense to me.
Comment #15
gabesulliceFair enough, reverted IS and title.
New issue: #2936725: EntityDataDefinition::create() does not respect derived entity definitions