renaming some function in paginator + fixing bug in paginator

- the '*itemPerPage' function are renamed '*itemsPerPage'
- the paginatorFactory now get the route parameters correctly
This commit is contained in:
2016-09-02 08:20:08 +02:00
parent ede767d01a
commit 1b674f9141
4 changed files with 65 additions and 53 deletions

View File

@@ -22,12 +22,12 @@ namespace Chill\MainBundle\Pagination;
/**
* Represent a set of numbered pages
*
*
* Allow to calculate and render pagination for a set of pages.
*
* The items are elements that `could` be shown. The item are divided and shown
* into pages. Each page is numbered and count a given number of item per page.
*
*
* The items are elements that `could` be shown. The item are divided and shown
* into pages. Each page is numbered and count a given number of item per page.
*
* The first page number is 1, although the first result number is 0.
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
@@ -35,40 +35,46 @@ namespace Chill\MainBundle\Pagination;
interface PaginatorInterface extends \Countable
{
/**
* get the number of result for this pagination
*
* get the number of results for this paginator
*
* @return int
*/
public function getTotalItems();
/**
* get the first result for the current page
*
*
* @return int
*/
public function getCurrentPageFirstItemNumber();
public function getItemPerPage();
public function setItemPerPage($itemPerPage);
/*
* get the number of items per page
*/
public function getItemsPerPage();
/*
* set the number of items per page
*/
public function setItemsPerPage($itemsPerPage);
/**
* get the number of page for this pagination.
*
* get the number of pages for this pagination.
*
* @return int
*/
public function countPages();
/**
* get the current page
*
*
* @return PageInterface
*/
public function getCurrentPage();
/**
* check if the given page is the current page
*
*
* @param \Chill\MainBundle\Pagination\PageInterface $page
* @return bool
*/
@@ -76,14 +82,14 @@ interface PaginatorInterface extends \Countable
/**
* check if the page with the given number exists
*
*
* @param int $number
*/
public function hasPage($number);
/**
* get page by his number
*
*
* @param int $number
* @throws \RuntimeException if the pagination has no page with specified number
*/
@@ -91,7 +97,7 @@ interface PaginatorInterface extends \Countable
/**
* get the next page
*
*
* @return PageInterface
* @throws \RuntimeException if the pagination has not next page
*/
@@ -99,7 +105,7 @@ interface PaginatorInterface extends \Countable
/**
* get the previous page
*
*
* @return PageInterface
* @throws \RuntimeException if the pagination has not previous page
*/
@@ -107,21 +113,21 @@ interface PaginatorInterface extends \Countable
/**
* check if the current page has a next page
*
*
* @return bool
*/
public function hasNextPage();
/**
* check if the current page has a page before
*
*
* @return bool
*/
public function hasPreviousPage();
/**
* get a generator to generate pages
*
*
* @return \Generator which return PageInterface elements
*/
public function getPagesGenerator();