mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
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:
parent
ede767d01a
commit
1b674f9141
@ -76,7 +76,7 @@ class SearchController extends Controller
|
||||
$pattern,
|
||||
$name,
|
||||
$paginatorFactory->getCurrentPageFirstItemNumber(),
|
||||
$paginatorFactory->getCurrentItemPerPage(),
|
||||
$paginatorFactory->getCurrentItemsPerPage(),
|
||||
array(SearchInterface::SEARCH_PREVIEW_OPTION => false)
|
||||
)];
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ class PaginatorFactory
|
||||
|
||||
return new Paginator(
|
||||
$totalItems,
|
||||
$this->getCurrentItemPerPage(),
|
||||
$this->getCurrentItemsPerPage(),
|
||||
$this->getCurrentPageNumber(),
|
||||
$route === null ? $this->getCurrentRoute() : $route,
|
||||
$routeParameters === null ? $this->getCurrentRouteParameters() :
|
||||
@ -109,7 +109,7 @@ class PaginatorFactory
|
||||
->getInt(self::DEFAULT_CURRENT_PAGE_KEY, self::DEFAULT_PAGE_NUMBER);
|
||||
}
|
||||
|
||||
public function getCurrentItemPerPage()
|
||||
public function getCurrentItemsPerPage()
|
||||
{
|
||||
return $this->requestStack
|
||||
->getCurrentRequest()
|
||||
@ -120,7 +120,7 @@ class PaginatorFactory
|
||||
public function getCurrentPageFirstItemNumber()
|
||||
{
|
||||
return ($this->getCurrentPageNumber() - 1) *
|
||||
$this->getCurrentItemPerPage();
|
||||
$this->getCurrentItemsPerPage();
|
||||
}
|
||||
|
||||
protected function getCurrentRoute()
|
||||
@ -134,7 +134,13 @@ class PaginatorFactory
|
||||
{
|
||||
return array_merge(
|
||||
$this->router->getContext()->getParameters(),
|
||||
$this->requestStack->getCurrentRequest()
|
||||
->query->all());
|
||||
// get the route parameters
|
||||
$this->requestStack
|
||||
->getCurrentRequest()
|
||||
->attributes->get('_route_params'),
|
||||
// get the query parameters
|
||||
$this->requestStack
|
||||
->getCurrentRequest()->query->all()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ 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
|
||||
*/
|
||||
@ -48,12 +48,18 @@ interface PaginatorInterface extends \Countable
|
||||
*/
|
||||
public function getCurrentPageFirstItemNumber();
|
||||
|
||||
public function getItemPerPage();
|
||||
/*
|
||||
* get the number of items per page
|
||||
*/
|
||||
public function getItemsPerPage();
|
||||
|
||||
public function setItemPerPage($itemPerPage);
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user