-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Pass $data in fetchAll() to the TableGatewayPaginator #73
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. Originally posted by @cvuorinen at zfcampus/zf-apigility#29 (comment) |
Can't wait to see this happen! 👍 Originally posted by @mrova at zfcampus/zf-apigility#29 (comment) |
It would be very useful for RAD 👍 Originally posted by @jahd2602 at zfcampus/zf-apigility#29 (comment) |
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. Originally posted by @AhtiAhde at zfcampus/zf-apigility#29 (comment) |
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 Originally posted by @AhtiAhde at zfcampus/zf-apigility#29 (comment) |
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.
Originally posted by @weierophinney at zfcampus/zf-apigility#29
The text was updated successfully, but these errors were encountered: