44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Controller\Admin\System\Availability;
|
|
|
|
use App\Repository\AvailabilityRepository;
|
|
use Knp\Component\Pager\PaginatorInterface;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
|
|
|
class IndexController extends AbstractController
|
|
{
|
|
public function __construct(
|
|
private readonly AvailabilityRepository $availabilityRepository,
|
|
private readonly PaginatorInterface $paginator
|
|
) {
|
|
}
|
|
|
|
#[Route('/admin/system/availability', name: 'app_admin_system_availability_index')]
|
|
#[IsGranted('ROLE_ADMIN')]
|
|
public function index(Request $request): Response
|
|
{
|
|
$query = $this
|
|
->availabilityRepository
|
|
->getListQuery()
|
|
;
|
|
|
|
$pagination = $this->paginator->paginate(
|
|
$query,
|
|
$request->query->getInt('page', 1),
|
|
10,
|
|
[
|
|
'defaultSortFieldName' => 'availability.dateFrom',
|
|
'defaultSortDirection' => 'asc',
|
|
]
|
|
);
|
|
|
|
return $this->render('admin/system/availability/index.html.twig', [
|
|
'pagination' => $pagination,
|
|
]);
|
|
}
|
|
} |