api-platform / api-platform/core

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

未关闭
#7,977 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
doctrine GraphQL
主要语言
PHP
星标
2.6k
派生
980
平均合并
2 天 2 小时
30 天内合并 PR
51

描述

**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 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。