Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filters with yaml #1755

Closed
ahmed-hachena opened this issue Mar 7, 2018 · 3 comments
Closed

filters with yaml #1755

ahmed-hachena opened this issue Mar 7, 2018 · 3 comments

Comments

@ahmed-hachena
Copy link

I think filters with yaml are not supported, only with annotation like this from doc
@ApiFilter(BooleanFilter::class, properties={"isAvailableGenericallyInMyCountry"})

it would be cool to have yaml support for filters, like someone can configure everything in yaml not a part in yaml and another in annotation.

@antograssiot
Copy link
Contributor

@ahmed-hachena did you tried

resources:
  App\Entity\Foo:
        itemOperations ...
        attributes:
            filters: ['app.my_filter']

and

services: 
   app.my_filter: 
       parent: 'api_platform.doctrine.orm.search_filter' 
       arguments: [ { bar: ~  } ] 
       tags:      [ 'api_platform.filter' ] 

it should already work I think

@soyuka
Copy link
Member

soyuka commented Mar 8, 2018

Filters are definitely supported in yaml, there is an example in the docs https://api-platform.com/docs/core/filters#doctrine-orm-filters

@soyuka soyuka closed this as completed Mar 8, 2018
@ahmed-hachena
Copy link
Author

thanks guys it works, sorry I didn't see the first part of filters docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants