-
Notifications
You must be signed in to change notification settings - Fork 51
Pass $data in fetchAll() to the TableGatewayPaginator #29
Comments
I think having this feature built-in would be very helpful, even without UI if it was well documented. Most use cases could probably be covered with some sensible default implementation. I posted something I put together quickly in the mailing list discussion. |
Can't wait to see this happen! 👍 |
It would be very useful for RAD 👍 |
We made a simple implementation of this, which only enables WHERE and ORDER. e.g.
Not sure if GROUP BY even belongs to the RESTful API domain. Sure it wouldn't hurt and might have some use cases. We didn't implement it. It seems that in proper RESTful API implementation you use You need to add this class to the namespace of your project and define Add the line Then you need to add 'sort' and 'order' to your Collection Query Whitelist among with all the field names you want to be able to filter by. |
When Apigility realeases a proper implementation, it would be quite important that the solution complies with the best practices of RESTful API world: http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#advanced-queries |
This repository has been closed and moved to laminas-api-tools/api-tools; a new issue has been opened at laminas-api-tools/api-tools#73. |
Per the mailing list, it may make sense to pass the
$data
argument ofDbConnectedResource::fetchAll()
to theTableGatewayPaginator
(as the second argument, forming the$where
clause).However...
It may also make sense to map query string parameters to the clause they should be used in.
Zend\Paginator\Adapter\DbTableGateway
has the following arguments:$tableGateway
- already being passed, for obvious reasons.$where
- to create the WHERE clause$order
- to sort the returned values$group
- for GROUP BY clauses$having
- for HAVING clausesEach of the latter four can take an associative array of arguments.
As such, this feature should likely not pass $data directly, but instead map parameters to arguments... which means a related UI feature.
The text was updated successfully, but these errors were encountered: