knpuniversity/rest — pull request #28 by weaverryan (2014-11-06 23:39:22+00:00)
Title: Pagination and Filtering

Hi there!

This is pretty simple. The only ugly-ish thing is that I didn't want to bring in Pagerfanta just to do the filtering (I thought it is an unnecessary detail, especially since I'd need to do some manual things or have a custom adapter for my silly simple ORM). So, I added my own simple pagination, which is faked and is as simple as possible. I hope this will focus them, without distracting or just being confusing because of its simplicity. If you disagree with my approach, let me know.

Steps:

1) Add the new scenario
2) Added some faked pagination use the `PaginatedRepresentation` with hardcoded data
3) Add "real" pagination (still a bit fake, just using array_slice, but it works)
4) Add filtering, just to show that you can just filter using query params if you want. Afaik, Hal doesn't really prescribe anything for this - e.g. I don't think it has any templates for helping to build these types of URLs). You just need to document them.

Finally, documentation is the next big thing on the list. And this one troubles me still. We have:

A) Documentation of the rels (and I believe we should change the rels to be URLs)
B) Documentation of the endpoints themselves - e.g. traditional API doc, like NelmioApiDocBundle. This also (obviously) includes the non-GET endpoints and what data needs to be sent to each
C) Other things, like the filter I added here (which was totally custom).

What ideas do you have?

Thanks!