feat: custom destinations

This commit is contained in:
Björn Fromme committed 2024-05-15 17:32:07 +02:00
1 parent 57e1082f2f
commit efc4b58077
27 files changed
+826 -40

No files matched your search

@@ -0,0 +1,44 @@
<?php
namespace App\Controller\Administrative\System\Destination;
use App\Repository\DestinationRepository;
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;
class IndexController extends AbstractController
{
public function __construct(
private readonly DestinationRepository $destinationRepository,
private readonly PaginatorInterface $paginator,
) {
}
#[Route('/administrative/system/destination', name: 'app_administrative_system_destination_index')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(Request $request): Response
{
$query = $this
->destinationRepository
->getListQueryForCustom()
;
$pagination = $this->paginator->paginate(
$query,
$request->query->getInt('page', 1),
10,
[
'defaultSortFieldName' => 'destination.dateFrom',
'defaultSortDirection' => 'desc',
]
);
return $this->render('administrative/system/destination/index.html.twig', [
'pagination' => $pagination,
]);
}
}