laminas-api-tools / api-tools

Laminas API Tools module for Laminas
https://api-tools.getlaminas.org/documentation
BSD 3-Clause "New" or "Revised" License
37 stars 19 forks source link

Searching #60

Open michalbundyra opened 4 years ago

michalbundyra commented 4 years ago

Hello, it's possible to search using apiglity ? Using query string params ? For example, search user list by name, birthday, etc ? Automatic search


Originally posted by @luqezman at https://github.com/zfcampus/zf-apigility/issues/77

michalbundyra commented 4 years ago

Hi joaolucas89,

the zf-apigility-doctrine module contains filters like you describe. Read the documentation here for details: https://github.com/zfcampus/zf-apigility-doctrine

The filters are a good idea in theory but in practice it's not as beneficial. For instance, you don't want to allow your users to query on just anything. So, I'm pulling them into their own repository so you can apply the filters to any Query Builder object.

Stay tuned and/or come contribute, Tom


Originally posted by @TomHAnderson at https://github.com/zfcampus/zf-apigility/issues/77#issuecomment-60638569

michalbundyra commented 4 years ago

zf-apigility-doctrine provide collection attributes like total, page_count, limit ?


Originally posted by @luqezman at https://github.com/zfcampus/zf-apigility/issues/77#issuecomment-60645276

michalbundyra commented 4 years ago

If your collection is a Zend\Paginator\Paginator instance you will have full pagination options. You can read on this here in the documentationof the zf-rest module.

If you make your collection to an instance of Countable then the Hal plugin will automatically count your total items and add a total_items key in the rendered result. This happens because the Hal plugin is checking this while rendering the collection.


Originally posted by @Wilt at https://github.com/zfcampus/zf-apigility/issues/77#issuecomment-75953489