Skip to content

:property key cannot be used in SearchFilter (Symfony only) #7495

@ttskch

Description

@ttskch

API Platform version(s) affected: 4.2.2

Description

As the document warns, ApiFilter is currently deprecated and using QueryParameter is recommended.

However, there are several bugs when applying filters using QueryParameter.

:property key cannot be used in SearchFilter (Symfony only)

Although SearchFilter is deprecated, it has the following bugs:

#[QueryParameter(key: ':property', filter: 'serviceId.for.search_filter', properties: ['title', 'note'])]

Although this code correctly outputs the parameters in OpenAPI as shown below, filtering does not actually occur when making requests with ?title={query} or ?note={query} appended.

The above code works correctly in Laravel, so it appears to be a bug in the Symfony version.

Incidentally, the following code also works correctly in Symfony.

#[QueryParameter(key: 'title', filter: 'serviceId.for.search_filter')]
#[QueryParameter(key: 'note', filter: 'serviceId.for.search_filter')]

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