Skip to content

Commit

Permalink
Updated route names.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentmuller committed Jun 1, 2024
1 parent 9040610 commit 3b89eba
Show file tree
Hide file tree
Showing 69 changed files with 320 additions and 317 deletions.
2 changes: 1 addition & 1 deletion public/js/application/user_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
showModification: false,
rules: {
'user': {
remote: {
remote: {
url: url,
data: {
user: function () {
Expand Down
6 changes: 3 additions & 3 deletions resources/data/site_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,17 @@
]
},
{
"route": "about",
"route": "about_index",
"text": "about.title",
"icon": "info-circle",
"entries": [
{
"route": "about_licence",
"route": "about_licence_index",
"text": "about.licence",
"icon": "info-circle"
},
{
"route": "about_policy",
"route": "about_policy_index",
"text": "about.policy",
"icon": "info-circle"
},
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/AboutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
* Controller for application information.
*/
#[AsController]
#[Route(path: '/about', name: 'about')]
#[Route(path: '/about', name: 'about_')]
#[IsGranted(RoleInterface::ROLE_USER)]
class AboutController extends AbstractController
{
#[Get(path: '', name: '')]
#[Get(path: '', name: 'index')]
public function index(
#[Autowire('%kernel.environment%')]
string $app_env,
Expand All @@ -46,7 +46,7 @@ public function index(
]);
}

#[Get(path: '/pdf', name: '_pdf')]
#[Get(path: '/pdf', name: 'pdf')]
public function pdf(#[Autowire('%app_name%')] string $appName): PdfResponse
{
$parameters = [
Expand All @@ -67,7 +67,7 @@ public function pdf(#[Autowire('%app_name%')] string $appName): PdfResponse
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @throws \PhpOffice\PhpWord\Exception\Exception
*/
#[Get(path: '/word', name: '_word')]
#[Get(path: '/word', name: 'word')]
public function word(#[Autowire('%app_name%')] string $appName): WordResponse
{
$parameters = [
Expand Down
10 changes: 5 additions & 5 deletions src/Controller/AboutLicenceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
* Controller to output license information.
*/
#[AsController]
#[Route(path: '/about/licence', name: 'about_licence')]
#[Route(path: '/about/licence', name: 'about_licence_')]
class AboutLicenceController extends AbstractController
{
#[IsGranted(RoleInterface::ROLE_USER)]
#[Get(path: '/content', name: '_content')]
#[Get(path: '/content', name: 'content')]
public function content(): JsonResponse
{
$parameters = [
Expand All @@ -46,7 +46,7 @@ public function content(): JsonResponse
}

#[IsGranted(AuthenticatedVoter::PUBLIC_ACCESS)]
#[Get(path: '', name: '')]
#[Get(path: '', name: 'index')]
public function index(): Response
{
$parameters = [
Expand All @@ -58,7 +58,7 @@ public function index(): Response
}

#[IsGranted(AuthenticatedVoter::PUBLIC_ACCESS)]
#[Get(path: '/pdf', name: '_pdf')]
#[Get(path: '/pdf', name: 'pdf')]
public function pdf(): PdfResponse
{
$parameters = [
Expand All @@ -77,7 +77,7 @@ public function pdf(): PdfResponse
* @throws \PhpOffice\PhpWord\Exception\Exception
*/
#[IsGranted(RoleInterface::ROLE_USER)]
#[Get(path: '/word', name: '_word')]
#[Get(path: '/word', name: 'word')]
public function word(): WordResponse
{
$parameters = [
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/AboutMySqlController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
* Controller to output MySQL information.
*/
#[AsController]
#[Route(path: '/about/mysql', name: 'about_mysql')]
#[Route(path: '/about/mysql', name: 'about_mysql_')]
class AboutMySqlController extends AbstractController
{
#[IsGranted(RoleInterface::ROLE_ADMIN)]
#[Get(path: '/content', name: '_content')]
#[Get(path: '/content', name: 'content')]
public function content(DatabaseInfoService $service): JsonResponse
{
$content = $this->renderView('about/mysql_content.html.twig', ['service' => $service]);
Expand All @@ -44,7 +44,7 @@ public function content(DatabaseInfoService $service): JsonResponse
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
#[IsGranted(RoleInterface::ROLE_ADMIN)]
#[Get(path: '/excel', name: '_excel')]
#[Get(path: '/excel', name: 'excel')]
public function excel(DatabaseInfoService $service): SpreadsheetResponse
{
$doc = new MySqlDocument($this, $service);
Expand All @@ -53,7 +53,7 @@ public function excel(DatabaseInfoService $service): SpreadsheetResponse
}

#[IsGranted(RoleInterface::ROLE_ADMIN)]
#[Get(path: '/pdf', name: '_pdf')]
#[Get(path: '/pdf', name: 'pdf')]
public function pdf(DatabaseInfoService $service): PdfResponse
{
$report = new MySqlReport($this, $service);
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/AboutPhpController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
* Controller to output PHP information.
*/
#[AsController]
#[Route(path: '/about/php', name: 'about_php')]
#[Route(path: '/about/php', name: 'about_php_')]
class AboutPhpController extends AbstractController
{
use ArrayTrait;

#[IsGranted(RoleInterface::ROLE_ADMIN)]
#[Get(path: '/content', name: '_content')]
#[Get(path: '/content', name: 'content')]
public function content(Request $request, PhpInfoService $service): JsonResponse
{
$parameters = [
Expand All @@ -54,7 +54,7 @@ public function content(Request $request, PhpInfoService $service): JsonResponse
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
#[IsGranted(RoleInterface::ROLE_ADMIN)]
#[Get(path: '/excel', name: '_excel')]
#[Get(path: '/excel', name: 'excel')]
public function excel(PhpInfoService $service): SpreadsheetResponse
{
$doc = new PhpIniDocument($this, $service);
Expand All @@ -63,7 +63,7 @@ public function excel(PhpInfoService $service): SpreadsheetResponse
}

#[IsGranted(RoleInterface::ROLE_ADMIN)]
#[Get(path: '/pdf', name: '_pdf')]
#[Get(path: '/pdf', name: 'pdf')]
public function pdf(PhpInfoService $service): PdfResponse
{
$report = new PhpIniReport($this, $service);
Expand Down
10 changes: 5 additions & 5 deletions src/Controller/AboutPolicyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
* Controller to output policy information.
*/
#[AsController]
#[Route(path: '/about/policy', name: 'about_policy')]
#[Route(path: '/about/policy', name: 'about_policy_')]
class AboutPolicyController extends AbstractController
{
#[IsGranted(RoleInterface::ROLE_USER)]
#[Get(path: '/content', name: '_content')]
#[Get(path: '/content', name: 'content')]
public function content(): JsonResponse
{
$parameters = [
Expand All @@ -46,7 +46,7 @@ public function content(): JsonResponse
}

#[IsGranted(AuthenticatedVoter::PUBLIC_ACCESS)]
#[Get(path: '', name: '')]
#[Get(path: '', name: 'index')]
public function index(): Response
{
$parameters = [
Expand All @@ -58,7 +58,7 @@ public function index(): Response
}

#[IsGranted(AuthenticatedVoter::PUBLIC_ACCESS)]
#[Get(path: '/pdf', name: '_pdf')]
#[Get(path: '/pdf', name: 'pdf')]
public function pdf(): PdfResponse
{
$parameters = [
Expand All @@ -77,7 +77,7 @@ public function pdf(): PdfResponse
* @throws \PhpOffice\PhpWord\Exception\Exception
*/
#[IsGranted(RoleInterface::ROLE_USER)]
#[Get(path: '/word', name: '_word')]
#[Get(path: '/word', name: 'word')]
public function word(): WordResponse
{
$parameters = [
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/AboutSymfonyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
* Controller to output symfony information.
*/
#[AsController]
#[Route(path: '/about/symfony', name: 'about_symfony')]
#[Route(path: '/about/symfony', name: 'about_symfony_')]
class AboutSymfonyController extends AbstractController
{
#[IsGranted(RoleInterface::ROLE_ADMIN)]
#[Get(path: '/content', name: '_content')]
#[Get(path: '/content', name: 'content')]
public function content(SymfonyInfoService $service): JsonResponse
{
$content = $this->renderView('about/symfony_content.html.twig', ['service' => $service]);
Expand All @@ -44,7 +44,7 @@ public function content(SymfonyInfoService $service): JsonResponse
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
#[IsGranted(RoleInterface::ROLE_ADMIN)]
#[Get(path: '/excel', name: '_excel')]
#[Get(path: '/excel', name: 'excel')]
public function excel(SymfonyInfoService $service): SpreadsheetResponse
{
$doc = new SymfonyDocument($this, $service);
Expand All @@ -53,7 +53,7 @@ public function excel(SymfonyInfoService $service): SpreadsheetResponse
}

#[IsGranted(RoleInterface::ROLE_ADMIN)]
#[Get(path: '/pdf', name: '_pdf')]
#[Get(path: '/pdf', name: 'pdf')]
public function pdf(SymfonyInfoService $service): PdfResponse
{
$doc = new SymfonyReport($this, $service);
Expand Down
14 changes: 8 additions & 6 deletions src/Controller/AbstractEntityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;

/**
* Abstract controller for entities management.
Expand Down Expand Up @@ -73,7 +75,7 @@ public function __construct(private readonly AbstractRepository $repository)
* Throws an exception unless the given attribute is granted against
* the current authentication token and this entity class name.
*
* @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException if the access is denied
* @throws AccessDeniedException
*/
protected function checkPermission(EntityPermission ...$permissions): void
{
Expand Down Expand Up @@ -250,7 +252,7 @@ protected function redirectToDefaultRoute(
}

/**
* @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException
* @throws AccessDeniedException
*/
protected function renderPdfDocument(PdfDocument $doc, bool $inline = true, string $name = ''): PdfResponse
{
Expand All @@ -260,7 +262,7 @@ protected function renderPdfDocument(PdfDocument $doc, bool $inline = true, stri
}

/**
* @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException
* @throws AccessDeniedException
* @throws \PhpOffice\PhpSpreadsheet\Exception
*/
protected function renderSpreadsheetDocument(
Expand All @@ -274,8 +276,8 @@ protected function renderSpreadsheetDocument(
}

/**
* @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @throws AccessDeniedException
* @throws NotFoundHttpException
* @throws \PhpOffice\PhpWord\Exception\Exception
*/
protected function renderWordDocument(WordDocument $doc, bool $inline = true, string $name = ''): WordResponse
Expand Down Expand Up @@ -304,7 +306,7 @@ protected function saveToDatabase(EntityInterface $item): void
/**
* Show properties of an entity.
*
* @throws \Symfony\Component\Finder\Exception\AccessDeniedException if the access is denied
* @throws AccessDeniedException
*
* @psalm-param TEntity $item
*/
Expand Down
12 changes: 6 additions & 6 deletions src/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* Controller for administration tasks.
*/
#[AsController]
#[Route(path: '/admin', name: 'admin')]
#[Route(path: '/admin', name: 'admin_')]
#[IsGranted(RoleInterface::ROLE_ADMIN)]
class AdminController extends AbstractController
{
Expand All @@ -52,7 +52,7 @@ class AdminController extends AbstractController
*
* @throws InvalidArgumentException
*/
#[GetPost(path: '/clear', name: '_clear')]
#[GetPost(path: '/clear', name: 'clear')]
public function clearCache(
Request $request,
KernelInterface $kernel,
Expand Down Expand Up @@ -95,7 +95,7 @@ public function clearCache(
* @throws \Exception
*/
#[IsGranted(RoleInterface::ROLE_SUPER_ADMIN)]
#[Get(path: '/dump-sql', name: '_dump_sql')]
#[Get(path: '/dump-sql', name: 'dump_sql')]
public function dumpSql(CommandService $service): Response
{
$result = $service->execute('doctrine:schema:update', ['--dump-sql' => true]);
Expand All @@ -116,7 +116,7 @@ public function dumpSql(CommandService $service): Response
/**
* Edit the application parameters.
*/
#[GetPost(path: '/parameters', name: '_parameters')]
#[GetPost(path: '/parameters', name: 'parameters')]
public function parameters(Request $request): Response
{
$application = $this->getApplicationService();
Expand All @@ -142,7 +142,7 @@ public function parameters(Request $request): Response
* Edit rights for the administrator role (@see RoleInterface::ROLE_ADMIN).
*/
#[IsGranted(RoleInterface::ROLE_SUPER_ADMIN)]
#[GetPost(path: '/rights/admin', name: '_rights_admin')]
#[GetPost(path: '/rights/admin', name: 'rights_admin')]
public function rightsAdmin(Request $request, RoleBuilderService $service): Response
{
$application = $this->getApplicationService();
Expand All @@ -157,7 +157,7 @@ public function rightsAdmin(Request $request, RoleBuilderService $service): Resp
/**
* Edit rights for the user role (@see RoleInterface::ROLE_USER).
*/
#[GetPost(path: '/rights/user', name: '_rights_user')]
#[GetPost(path: '/rights/user', name: 'rights_user')]
public function rightsUser(Request $request, RoleBuilderService $service): Response
{
$application = $this->getApplicationService();
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/AjaxCalculationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* Controller for calculation XMLHttpRequest (Ajax) calls.
*/
#[AsController]
#[Route(path: '/ajax', name: 'ajax')]
#[Route(path: '/ajax', name: 'ajax_')]
#[IsGranted(RoleInterface::ROLE_USER)]
class AjaxCalculationController extends AbstractController
{
Expand All @@ -39,7 +39,7 @@ class AjaxCalculationController extends AbstractController
*
* @psalm-api
*/
#[Get(path: '/dialog/item', name: '_dialog_item')]
#[Get(path: '/dialog/item', name: 'dialog_item')]
public function renderItemDialog(): JsonResponse
{
$parameters = [
Expand All @@ -54,7 +54,7 @@ public function renderItemDialog(): JsonResponse
*
* @psalm-api
*/
#[Get(path: '/dialog/task', name: '_dialog_task')]
#[Get(path: '/dialog/task', name: 'dialog_task')]
public function renderTaskDialog(TaskRepository $repository): JsonResponse
{
$parameters = [
Expand All @@ -70,7 +70,7 @@ public function renderTaskDialog(TaskRepository $repository): JsonResponse
*
* @throws \Doctrine\ORM\Exception\ORMException
*/
#[Post(path: '/update', name: '_update')]
#[Post(path: '/update', name: 'update')]
public function update(Request $request, CalculationService $service, LoggerInterface $logger): JsonResponse
{
try {
Expand Down
Loading

0 comments on commit 3b89eba

Please sign in to comment.