Created
July 22, 2014 18:57
-
-
Save gondo/c24e196a8d3f159fb2ab to your computer and use it in GitHub Desktop.
Revisions
-
gondo created this gist
Jul 22, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ public function listAction() { $em = $this->getDoctrine()->getManager(); $repository = $em->getRepository('ExampleBundle:Entity'); $qb = $historyRepository->createQueryBuilder('EntityAlias'); $knpPaginator = $this->get('knp_paginator'); $paginationAAA = $knpPaginator->paginate( $qb, $this->get('request')->query->get('pageAAA', 1), // page number 10, // limit per page array( 'pageParameterName' => 'pageAAA', 'sortFieldParameterName' => 'sortAAA', 'sortDirectionParameterName' => 'directionAAA', ) ); $paginationBBB = $knpPaginator->paginate( $qb, $this->get('request')->query->get('pageBBB', 1), // page number 10, // limit per page array( 'pageParameterName' => 'pageBBB', 'sortFieldParameterName' => 'sortBBB', 'sortDirectionParameterName' => 'directionBBB', ) ); return array( 'paginationAAA' => $paginationAAA, 'paginationBBB' => $paginationBBB, ); } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ {% if paginationAAA.getTotalItemCount > 0 %} <table> <thead> <tr> <th> {{ knp_pagination_sortable(paginationAAA, 'Field', 'EntityAlias.field', {'defaultDirection' : 'desc'}) }} </th> </tr> </thead> <tbody> {% for rows in paginationAAA %} <tr> <td> {{ row.field }} </td> {% endfor %} </tbody> </table> {{ knp_pagination_render(paginationAAA) }} {% else %} No data. {% endif %} {% if paginationBBB.getTotalItemCount > 0 %} <table> <thead> <tr> <th> {{ knp_pagination_sortable(paginationBBB, 'Field', 'EntityAlias.field', {'defaultDirection' : 'desc'}) }} </th> </tr> </thead> <tbody> {% for rows in paginationBBB %} <tr> <td> {{ row.field }} </td> {% endfor %} </tbody> </table> {{ knp_pagination_render(paginationBBB) }} {% else %} No data. {% endif %}