mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Add interface for pagination
This commit is contained in:
56
src/Bundle/ChillMainBundle/Test/DummyPaginator.php
Normal file
56
src/Bundle/ChillMainBundle/Test/DummyPaginator.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Test;
|
||||
|
||||
use Chill\MainBundle\Pagination\Paginator;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactoryInterface;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
class DummyPaginator implements PaginatorFactoryInterface
|
||||
{
|
||||
public function __construct(
|
||||
private UrlGeneratorInterface $urlGenerator,
|
||||
private string $route,
|
||||
private array $routeParameters = []
|
||||
) {}
|
||||
|
||||
public function create(int $totalItems, string $route = null, array $routeParameters = null): PaginatorInterface
|
||||
{
|
||||
return new Paginator(
|
||||
$totalItems,
|
||||
$totalItems,
|
||||
1,
|
||||
$this->route,
|
||||
$this->routeParameters,
|
||||
$this->urlGenerator,
|
||||
PaginatorFactory::DEFAULT_CURRENT_PAGE_KEY,
|
||||
PaginatorFactory::DEFAULT_ITEM_PER_NUMBER_KEY
|
||||
);
|
||||
}
|
||||
|
||||
public function getCurrentItemsPerPage(): int
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
public function getCurrentPageFirstItemNumber(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function getCurrentPageNumber(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user