api-platform / api-platform/core
Accessing sub-entities through a base routing name - Single Table Inheritance and GraphQL
- 主要語言
- PHP
- 星號
- 2.6k
- 分支
- 980
- 平均合併
- 2 天 4 小時
- 30 天內合併 PR
- 49
描述
**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?
貢獻指南
評估
這個 Issue 還沒有評估資料。