Core: [Question] Filters on custom collection data provider

Created on 20 Apr 2018  路  8Comments  路  Source: api-platform/core

I have a Custom Collection Data Provider an was wondering if i could use the build in filter functions of ApiPlatform? If there is a way to do this it would be very nice it could be added to the documentation.

Greetings
Leon Bergmmann

All 8 comments

Yes just inject extensions https://api-platform.com/docs/core/data-providers#injecting-extensions-pagination-filter-eagerloading-etc

@soyuka Thanks for the hint.
The provided example is a liitle ambiguose because it only show the filtering for an item data provider not an collection data provider. Also i think there is missing some code?

Yes there is sorry about that. Take a look here:

https://github.com/api-platform/docs/blob/2.2/core/data-providers.md#injecting-extensions-pagination-filter-eagerloading-etc

replace item by collection for collection extensions !

@soyuka thats done the trick, thank you very much.

I think it would be very nice to have this case also in the documentation on the website. Am I right that the best way to achieve this, is open a PR at the doc repo?

I gave you the direct link to the docs, they just need to be re-deployed! ping @meyerbaptiste can you do this? or maybe only @dunglas can?

Ahh sorry, I didn't make myself clear. I meant an example of a collection data provider with filters injected.

P.S. As far as I'm concerned, this issue is solved. I'm closing it.

Oh but it's almost the same. Anyway we would gladly accept a PR on the docs for it :).

I gave you the direct link to the docs, they just need to be re-deployed!

@soyuka the doc is deployed by Travis!

Was this page helpful?
0 / 5 - 0 ratings