Skip to content

Feature: BackedEnumFilter allow multiple values similar to SearchFilter[exact] #7128

Open
@MeronNagy

Description

@MeronNagy

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:

  1. Modifies filterProperty to accept array values and use IN SQL operator
  2. Updates getDescription to document both single value and array notation (propertyName[])
  3. Maintains backward compatibility with existing usage

I will link a PR shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions