Skip to content

Applying Filters to QueryParameter in unclear to me. #7232

Answered by soyuka
etshy asked this question in Q&A
Discussion options

You must be logged in to vote

Are Parameters only for documentation, and you need to define an ApiFilter (or a custom one) to it ?

Short answer yes. Defining an ApiFilter does two things: declare a filter Symfony service, add documentation.
The Parameter is a metadata-first approach and the filter is basically a simple callable (like I showed earlier). It's still compatible with services but as our current filters need some mandatory arguments it's hard to make them compatible (especially for the SearchFilter, see linked PR).

I'm sorry for the lack of documentation, best is to take a look at https://github.com/api-platform/core/tree/main/tests/Functional/Parameters and https://github.com/api-platform/core/blob/main/…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@etshy
Comment options

@soyuka
Comment options

Answer selected by etshy
@etshy
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants