api-platform / api-platform/core

Allow devs to give an alias to a filter property

Đang mở
#8,037 5 bình luận 16 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
PHP
Star
2.6k
Fork
980
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
49

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.