51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controller\Admin\BookingEditDraft;
|
|
|
|
use App\Controller\Traits\ReturnUrlTrait;
|
|
use App\Repository\BookingEditDraftRepository;
|
|
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\Attribute\Route;
|
|
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
|
|
|
#[IsGranted('ROLE_GROUPS_ADMIN')]
|
|
class IndexController extends AbstractController
|
|
{
|
|
use ReturnUrlTrait;
|
|
|
|
public function __construct(
|
|
private readonly BookingEditDraftRepository $bookingEditDraftRepository,
|
|
private readonly PaginatorInterface $paginator,
|
|
) {
|
|
}
|
|
|
|
#[Route('/admin/booking-edit-draft', name: 'app_admin_bookingeditdraft')]
|
|
public function index(Request $request): Response
|
|
{
|
|
$qb = $this
|
|
->bookingEditDraftRepository
|
|
->createQueryBuilder('booking_edit_draft')
|
|
->leftJoin('booking_edit_draft.user', 'user')
|
|
;
|
|
|
|
$pagination = $this->paginator->paginate(
|
|
$qb,
|
|
$request->query->getInt('page', 1),
|
|
$request->query->getInt('limit', 20),
|
|
[
|
|
'defaultSortFieldName' => 'booking_edit_draft.createdAt',
|
|
'defaultSortDirection' => 'DESC',
|
|
]
|
|
);
|
|
|
|
return $this->render('admin/booking_edit_draft/index.html.twig', [
|
|
'pagination' => $pagination,
|
|
]);
|
|
}
|
|
}
|