core
core copied to clipboard
Feature: BackedEnumFilter allow multiple values similar to SearchFilter[exact]
Description
Currently, the BackedEnumFilter in API Platform only supports filtering by a single enum value. This differs from the behavior of SearchFilter[exact], which can handle multiple values.
When migrating from string constants to backed enums, it would be nice if BackedEnumFilter could be a plug in solution for SearchFilter[exact].
Example
Before:
When using BackedEnumFilter, you can only filter by a single enum value:
GET /books?status=published
After:
Support both single values and multiple values
GET /books?status=published
GET /books?status[]=published&status[]=in_review
The implementation:
- Modifies
filterPropertyto accept array values and useINSQL operator - Updates
getDescriptionto document both single value and array notation (propertyName[]) - Maintains backward compatibility with existing usage
I will link a PR shortly.