api-platform / api-platform/core

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

Abierto
#7,977 0 comentarios 1 reacción 0 asignados Ver en GitHub
doctrine GraphQL
Lenguaje dominante
PHP
Estrellas
2.6k
Forks
980
Merge medio
2 d 2 h
PR fusionados (30 d)
51

Descripción

**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?

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.