Skip to content

Entity inheritance to GraphQL interface #6117

@calbro7

Description

@calbro7

I like the approach of GraphQLite: if Cat and Dog both inherit from some Animal class (stored in the database using either single table inheritance or class table inheritance), then the GraphQL schema generated will have an AnimalInterface which is then implemented by Cat and Dog. This allows one to perform queries like:

animals {
    id
    ... on Cat {
        someCatSpecificField
    }
    ... on Dog {
        someDogSpecificField
    }
}

to fetch all Animals along with their implementation-specific fields. Unless I'm missing something, this is not possible with API Platform? My application makes use of inheritance a lot so annoyingly it's pretty much just this issue that is ruling out API Platform.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions