Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -19,77 +19,61 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
/**
|
||||
* @Route(path="/timesheet")
|
||||
* @Security("is_granted('view_own_timesheet')")
|
||||
*/
|
||||
class TimesheetController extends TimesheetAbstractController
|
||||
#[Route(path: '/timesheet')]
|
||||
#[Security("is_granted('view_own_timesheet')")]
|
||||
final class TimesheetController extends TimesheetAbstractController
|
||||
{
|
||||
/**
|
||||
* @Route(path="/", defaults={"page": 1}, name="timesheet", methods={"GET"})
|
||||
* @Route(path="/page/{page}", requirements={"page": "[1-9]\d*"}, name="timesheet_paginated", methods={"GET"})
|
||||
* @Security("is_granted('view_own_timesheet')")
|
||||
*/
|
||||
#[Route(path: '/', defaults: ['page' => 1], name: 'timesheet', methods: ['GET'])]
|
||||
#[Route(path: '/page/{page}', requirements: ['page' => '[1-9]\d*'], name: 'timesheet_paginated', methods: ['GET'])]
|
||||
#[Security("is_granted('view_own_timesheet')")]
|
||||
public function indexAction(int $page, Request $request): Response
|
||||
{
|
||||
$query = $this->createDefaultQuery();
|
||||
$query->setPage($page);
|
||||
|
||||
return $this->index($query, $request, 'timesheet', 'timesheet/index.html.twig', TimesheetMetaDisplayEvent::TIMESHEET);
|
||||
return $this->index($query, $request, 'timesheet', 'timesheet_paginated', TimesheetMetaDisplayEvent::TIMESHEET);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/export/", name="timesheet_export", methods={"GET", "POST"})
|
||||
* @Security("is_granted('export_own_timesheet')")
|
||||
*/
|
||||
#[Route(path: '/export/', name: 'timesheet_export', methods: ['GET', 'POST'])]
|
||||
#[Security("is_granted('export_own_timesheet')")]
|
||||
public function exportAction(Request $request, ServiceExport $serviceExport): Response
|
||||
{
|
||||
return $this->export($request, $serviceExport);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/{id}/edit", name="timesheet_edit", methods={"GET", "POST"})
|
||||
* @Security("is_granted('edit', entry)")
|
||||
*/
|
||||
#[Route(path: '/{id}/edit', name: 'timesheet_edit', methods: ['GET', 'POST'])]
|
||||
#[Security("is_granted('edit', entry)")]
|
||||
public function editAction(Timesheet $entry, Request $request): Response
|
||||
{
|
||||
return $this->edit($entry, $request, 'timesheet/edit.html.twig');
|
||||
return $this->edit($entry, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/{id}/duplicate", name="timesheet_duplicate", methods={"GET", "POST"})
|
||||
* @Security("is_granted('duplicate', entry)")
|
||||
*/
|
||||
#[Route(path: '/{id}/duplicate', name: 'timesheet_duplicate', methods: ['GET', 'POST'])]
|
||||
#[Security("is_granted('duplicate', entry)")]
|
||||
public function duplicateAction(Timesheet $entry, Request $request): Response
|
||||
{
|
||||
return $this->duplicate($entry, $request, 'timesheet/edit.html.twig');
|
||||
return $this->duplicate($entry, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/multi-update", name="timesheet_multi_update", methods={"POST"})
|
||||
* @Security("is_granted('edit_own_timesheet')")
|
||||
*/
|
||||
#[Route(path: '/multi-update', name: 'timesheet_multi_update', methods: ['POST'])]
|
||||
#[Security("is_granted('edit_own_timesheet')")]
|
||||
public function multiUpdateAction(Request $request): Response
|
||||
{
|
||||
return $this->multiUpdate($request, 'timesheet/multi-update.html.twig');
|
||||
return $this->multiUpdate($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/multi-delete", name="timesheet_multi_delete", methods={"POST"})
|
||||
* @Security("is_granted('delete_own_timesheet')")
|
||||
*/
|
||||
#[Route(path: '/multi-delete', name: 'timesheet_multi_delete', methods: ['POST'])]
|
||||
#[Security("is_granted('delete_own_timesheet')")]
|
||||
public function multiDeleteAction(Request $request): Response
|
||||
{
|
||||
return $this->multiDelete($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/create", name="timesheet_create", methods={"GET", "POST"})
|
||||
* @Security("is_granted('create_own_timesheet')")
|
||||
*/
|
||||
#[Route(path: '/create', name: 'timesheet_create', methods: ['GET', 'POST'])]
|
||||
#[Security("is_granted('create_own_timesheet')")]
|
||||
public function createAction(Request $request): Response
|
||||
{
|
||||
return $this->create($request, 'timesheet/edit.html.twig');
|
||||
return $this->create($request);
|
||||
}
|
||||
|
||||
protected function getCreateForm(Timesheet $entry): FormInterface
|
||||
|
||||
Reference in New Issue
Block a user