Hateoas
Hateoas copied to clipboard
Adding a paging factory (KnpPaginatorFactory) for users of the paginator components of KNP -components
How to use with Knp-Components Pager
use Hateoas\Representation\Factory\KnpPaginatorFactory;
use Hateoas\Configuration\Route;
use new Knp\Component\Pager\Paginator;
// KnpPaginator component
$pager = Paginator();
$paginated = $pager->paginate($some, 1, 10);
$factory = new KnpPaginatorFactory();
$paginatedCollection= $factory->createRepresentation($paginated, new Route('my_route_name', array()));
$json = $hateoas->serialize($paginatedCollection, 'json');
$xml = $hateoas->serialize($paginatedCollection, 'xml');
Is this lib still maintained?
this lib is maintained by KnpLabs. On symfony bundle it exist KnpPaginatorBundle based on this lib
Alright. So let's fix the tests first, and then squash the commits so that we can get this merged :)
Looks good!
This can be helpful for the timeline bundle that ships with knp paginator support: https://github.com/stephpy/timeline-bundle/blob/master/Resources/doc/pagination.markdown
I saw a issue that talked about how to integrate knp paginator to create a representation of collection. Now it is true that it is not very useful on this library.
Thank you I will rather create a gist
I saw a issue that talked about how to integrate knp paginator to create a representation of collection. Now it is true that it is not very useful on this library.
hi, @skineur what is the issue you're talking about? why this hasn't been merged? I would found it quite useful