api-platform / api-platform/admin

Filter by relation's property

Open
#344 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
516
Forks
134
PR merge metrics
No merged PRs in 30d

Description

**API Platform version(s) affected**: 2.2.3 , 2.4.2

**Description**
I need to filter (SearchFilter) a resource with one of its association property. But in the filters in the admin page, I can see only the mobileNumber option.

**How to reproduce**
The documentation says it should be done with something like this:
```
* @ApiFilter(SearchFilter::class, properties={
* "mobileNumber": "partial",
* "label.title": "exact",
* })
```

here is the hydra:search section of the response :point_down::skin-tone-2:
```
hydra:search: {@type: "hydra:IriTemplate", hydra:template: "/users{?mobileNumber,label.title,label.title[]}",…}
@type: "hydra:IriTemplate"
hydra:mapping: [{@type: "IriTemplateMapping", variable: "mobileNumber", property: "mobileNumber", required: false},…]
0: {@type: "IriTemplateMapping", variable: "mobileNumber", property: "mobileNumber", required: false}
@type: "IriTemplateMapping"
property: "mobileNumber"
required: false
variable: "mobileNumber"
1: {@type: "IriTemplateMapping", variable: "label.title", property: "label.title", required: false}
@type: "IriTemplateMapping"
property: "label.title"
required: false
variable: "label.title"
2: {@type: "IriTemplateMapping", variable: "label.title[]", property: "label.title", required: false}
@type: "IriTemplateMapping"
property: "label.title"
required: false
variable: "label.title[]"
hydra:template: "/users{?mobileNumber,label.title,label.title[]}"
hydra:variableRepresentation: "BasicRepresentation"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.