api-platform / api-platform/core

Accessing sub-entities through a base routing name - Single Table Inheritance and GraphQL

Ouverte
#7,977 0 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
doctrine GraphQL
Langage dominant
PHP
Étoiles
2.6k
Forks
980
Merge moyen
2 j 2 h
PR mergées (30 j)
51

Description

**Description**
This RFC applies to a specific case.
It's a case were Doctrine's Single Table Inheritance is used i.c.w. GraphQL and a UuidGenerator.

Let's say you have a `Vehicle` entity which serves as the base entity.
The `Vehicle` class has the `@ORM\InheritanceType("SINGLE_TABLE")`.

You also have a `Car` a `Boat` a `Train` and an `Airplane` entity.
Those entities are inheriting the `Vehicle` class (`extends Vehicle`).
Let's call them sub-entities.

GraphQL is able to expose all these entities through the collection query. Example result:

```
{
"data": {
"vehicles": {
"edges": [
{
"node": {
"id": "/api/cars/11111111-1111-1111-1111-111111111111"
}
},
{
"node": {
"id": "/api/cars/22222222-1111-1111-1111-111111111111"
}
},
{
"node": {
"id": "/api/trains/33333333-1111-1111-1111-111111111111"
}
},
{
"node": {
"id": "/api/boats/44444444-1111-1111-1111-111111111111"
}
},
{
"node": {
"id": "/api/airplanes/55555555-1111-1111-1111-111111111111"
}
},
]
}
}
}
```

As you can see the sub-entities are having their own routing name.

Accessing data from the sub-entities happens through their own routing name. Which works fine. E.g.

`/api/cars/11111111-1111-1111-1111-111111111111`

However, it is not possible to access sub-entities through the a base routing name.

`/api/vehicles/11111111-1111-1111-1111-111111111111`

### Accessing sub-entities through a base routing name
Will it be possible to make the sub-entities available through the base routing name?

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.