api-platform / api-platform/core

Allow devs to give an alias to a filter property

未关闭
#8,037 5 条评论 16 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
PHP
星标
2.6k
派生
980
平均合并
2 天 4 小时
30 天内合并 PR
49

描述

**Description**
Allow devs to give an alias to a filter property, so that the user doesn't have to use a big query string parameter

**Example**
I have the following in an entity:
```
#[ApiFilter(SearchFilter::class, properties: ['baseProduct.brand.name' => 'partial'])]
```

So to filter by brand the user will have to do:
```
?baseProduct.brand.name=brandx
```

So maybe if I could do this:
```
#[ApiFilter(SearchFilter::class, properties: ['baseProduct.brand.name' => 'partial'], alias:['brand' => 'baseProduct.brand.name'] )]
```
The user could then do:
```
?brand=brandx
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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