Filter not working with embedded properties (multiple levels)
See original GitHub issueI dont know if this relates to https://github.com/api-platform/api-platform/issues/277 but I have a issue with filtering by embedded properties. For example, I have to following entity structure:
User
hasProfile
Profile
hasAddress
Address
haspostalCode
(string
)
So when I call
/api/users?profile.address.postalCode=88
with the filter configuration
filter.search_user:
parent: 'api_platform.doctrine.orm.search_filter'
arguments: [ { profile.firstName: 'partial', profile.lastName: 'partial', profile.address.postalCode: 'starts' } ]
tags: [ { name: 'api_platform.filter', id: 'filter.search_user' } ]
I would expect a response that only contains users with a postal code starting with 88
. But all users are returned since the filter is not applied at all.
The same issue occurs when I call
/api/users?profile.firstName=Thomas
what should return only users with Thomas
in their firstName
but all users are returned. I digged a lot in the issues and found https://github.com/api-platform/core/pull/242 and https://github.com/api-platform/core/issues/83.
So is this already a feature and/or am I facing a bug?
EDIT: Thought that only occurs with embedded entities deeper that one level. But it seems its not possible to filter by embedded entity properties at all.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:12 (7 by maintainers)
Thanks. Can confirm that https://github.com/api-platform/core/pull/984 works like a charm. Also I accidentally used
starts
instead ofstart
.@Simperfit should work with as many levels as we need:
Extract of filters services: