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

@@ -25,7 +25,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
/**
* Standard paginator class.
*
*
* Represent a set of paginated pages;
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
@@ -75,7 +75,7 @@ class Paginator implements PaginatorInterface
protected $urlGenerator;
/**
* the key in the GET parameter to indicate the page number in
* the key in the GET parameter to indicate the page number in
* generated routes
*
* @var string
@@ -85,7 +85,7 @@ class Paginator implements PaginatorInterface
/**
* the key in the GET parameter to indicate the number of item per page
*
* @var string
* @var string
*/
protected $itemPerPageKey;
@@ -116,7 +116,7 @@ class Paginator implements PaginatorInterface
}
/**
*
*
* @return \Chill\MainBundle\Pagination\Page
*/
public function getCurrentPage()
@@ -134,12 +134,12 @@ class Paginator implements PaginatorInterface
return $page->getNumber() === $this->currentPageNumber;
}
public function getItemPerPage()
public function getItemsPerPage()
{
return $this->itemPerPage;
}
public function setItemPerPage($itemPerPage)
public function setItemsPerPage($itemPerPage)
{
$this->itemPerPage = $itemPerPage;
}
@@ -161,7 +161,7 @@ class Paginator implements PaginatorInterface
}
/**
*
*
* @return \Chill\MainBundle\Pagination\Page
* @throws \RuntimeException if the next page does not exists
*/
@@ -175,7 +175,7 @@ class Paginator implements PaginatorInterface
}
/**
*
*
* @return \Chill\MainBundle\Pagination\Page
* @throws \RuntimeException if the next page does not exists
*/
@@ -189,7 +189,7 @@ class Paginator implements PaginatorInterface
}
/**
*
*
* @return bool
*/
public function hasNextPage()
@@ -198,7 +198,7 @@ class Paginator implements PaginatorInterface
}
/**
*
*
* @return bool
*/
public function hasPreviousPage()
@@ -208,13 +208,13 @@ class Paginator implements PaginatorInterface
public function hasPage($number)
{
return $number > 0 and
return $number > 0 and
$number <= $this->countPages();
}
/**
*
*
* @param type $number
* @return \Chill\MainBundle\Pagination\Page
*/
@@ -225,7 +225,7 @@ class Paginator implements PaginatorInterface
}
return new Page(
$number,
$number,
$this->itemPerPage,
$this->urlGenerator,
$this->route,