Configure routes using annotation

This commit is contained in:
2023-08-02 16:26:25 +02:00
parent 4b20db7a9c
commit 009a0326d9
55 changed files with 215 additions and 772 deletions

View File

@@ -24,6 +24,7 @@ class CenterController extends AbstractController
{
/**
* Creates a new Center entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/center/create", name="admin_center_create", methods={"POST"})
*/
public function createAction(Request $request)
{
@@ -47,6 +48,7 @@ class CenterController extends AbstractController
/**
* Displays a form to edit an existing Center entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/center/{id}/edit", name="admin_center_edit")
*/
public function editAction(mixed $id)
{
@@ -68,6 +70,7 @@ class CenterController extends AbstractController
/**
* Lists all Center entities.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/center/", name="admin_center")
*/
public function indexAction()
{
@@ -82,6 +85,7 @@ class CenterController extends AbstractController
/**
* Displays a form to create a new Center entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/center/new", name="admin_center_new")
*/
public function newAction()
{
@@ -114,6 +118,7 @@ class CenterController extends AbstractController
/**
* Edits an existing Center entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/center/{id}/update", name="admin_center_update", methods={"POST", "PUT"})
*/
public function updateAction(Request $request, mixed $id)
{

View File

@@ -18,6 +18,9 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
*/
class DefaultController extends AbstractController
{
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/homepage", name="chill_main_homepage")
*/
public function indexAction()
{
if ($this->isGranted('ROLE_ADMIN')) {
@@ -27,6 +30,9 @@ class DefaultController extends AbstractController
return $this->render('@ChillMain/layout.html.twig');
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/homepage", name="chill_main_homepage_without_locale")
*/
public function indexWithoutLocaleAction()
{
return $this->redirectToRoute('chill_main_homepage');

View File

@@ -66,6 +66,9 @@ class ExportController extends AbstractController
) {
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/download/{alias}", name="chill_main_export_download", methods={"GET"})
*/
public function downloadResultAction(Request $request, $alias)
{
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
@@ -107,6 +110,7 @@ class ExportController extends AbstractController
* @param string $alias
*
* @return \Symfony\Component\HttpFoundation\Response
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/generate/{alias}", name="chill_main_export_generate", methods={"GET"})
*/
public function generateAction(Request $request, $alias)
{
@@ -150,6 +154,7 @@ class ExportController extends AbstractController
/**
* Render the list of available exports.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/", name="chill_main_export_index")
*/
public function indexAction(): Response
{
@@ -174,6 +179,7 @@ class ExportController extends AbstractController
* 3. 'generate': gather data from session from the previous steps, and
* make a redirection to the "generate" action with data in query (HTTP GET)
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/new/{alias}", name="chill_main_export_new")
*/
public function newAction(Request $request, string $alias): Response
{

View File

@@ -35,6 +35,7 @@ class LoginController extends AbstractController
* Show a login form.
*
* @return Response
* @\Symfony\Component\Routing\Annotation\Route(path="/login", name="login")
*/
public function loginAction(Request $request)
{

View File

@@ -26,6 +26,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
@@ -87,6 +88,7 @@ class PasswordController extends AbstractController
/**
* @return Response
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-changed", name="password_request_recover_changed")
*/
public function changeConfirmedAction()
{
@@ -95,6 +97,7 @@ class PasswordController extends AbstractController
/**
* @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/recover", name="password_recover")
*/
public function recoverAction(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
@@ -163,6 +166,7 @@ class PasswordController extends AbstractController
* @throws \Doctrine\ORM\NonUniqueResultException
*
* @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-recover", name="password_request_recover")
*/
public function requestRecoverAction(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
@@ -234,6 +238,7 @@ class PasswordController extends AbstractController
/**
* @return Response
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-confirm", name="password_request_recover_confirm")
*/
public function requestRecoverConfirmAction()
{
@@ -242,6 +247,7 @@ class PasswordController extends AbstractController
/**
* @return Response
* @Route("/{_locale}/my/password", name="change_my_password")
*/
public function UserPasswordAction(Request $request)
{

View File

@@ -54,6 +54,7 @@ final class PermissionsGroupController extends AbstractController
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/add_link_role_scope", name="admin_permissionsgroup_add_role_scope", methods={"PUT"})
*/
public function addLinkRoleScopeAction(Request $request, int $id): Response
{
@@ -132,6 +133,7 @@ final class PermissionsGroupController extends AbstractController
/**
* Creates a new PermissionsGroup entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/create", name="admin_permissionsgroup_create", methods={"POST"})
*/
public function createAction(Request $request): Response
{
@@ -154,6 +156,7 @@ final class PermissionsGroupController extends AbstractController
/**
* remove an association between permissionsGroup and roleScope.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{pgid}/delete_link_role_scope/{rsid}", name="admin_permissionsgroup_delete_role_scope", methods={"DELETE"})
*/
public function deleteLinkRoleScopeAction(int $pgid, int $rsid): Response
{
@@ -210,6 +213,7 @@ final class PermissionsGroupController extends AbstractController
/**
* Displays a form to edit an existing PermissionsGroup entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/edit", name="admin_permissionsgroup_edit")
*/
public function editAction(int $id): Response
{
@@ -256,6 +260,7 @@ final class PermissionsGroupController extends AbstractController
/**
* Lists all PermissionsGroup entities.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/", name="admin_permissionsgroup")
*/
public function indexAction(): Response
{
@@ -268,6 +273,7 @@ final class PermissionsGroupController extends AbstractController
/**
* Displays a form to create a new PermissionsGroup entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/new", name="admin_permissionsgroup_new")
*/
public function newAction(): Response
{
@@ -282,6 +288,7 @@ final class PermissionsGroupController extends AbstractController
/**
* Finds and displays a PermissionsGroup entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/show", name="admin_permissionsgroup_show")
*/
public function showAction(int $id): Response
{
@@ -333,6 +340,7 @@ final class PermissionsGroupController extends AbstractController
/**
* Edits an existing PermissionsGroup entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/update", name="admin_permissionsgroup_update", methods={"POST", "PUT"})
*/
public function updateAction(Request $request, int $id): Response
{

View File

@@ -24,6 +24,7 @@ class ScopeController extends AbstractController
{
/**
* Creates a new Scope entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/create", name="admin_scope_create", methods={"POST"})
*/
public function createAction(Request $request)
{
@@ -47,6 +48,7 @@ class ScopeController extends AbstractController
/**
* Displays a form to edit an existing Scope entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/{id}/edit", name="admin_scope_edit")
*/
public function editAction(mixed $id)
{
@@ -68,6 +70,7 @@ class ScopeController extends AbstractController
/**
* Lists all Scope entities.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/", name="admin_scope")
*/
public function indexAction()
{
@@ -82,6 +85,7 @@ class ScopeController extends AbstractController
/**
* Displays a form to create a new Scope entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/new", name="admin_scope_new")
*/
public function newAction()
{
@@ -114,6 +118,7 @@ class ScopeController extends AbstractController
/**
* Edits an existing Scope entity.
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/{id}/update", name="admin_scope_update", methods={"POST", "PUT"})
*/
public function updateAction(Request $request, mixed $id)
{

View File

@@ -40,6 +40,9 @@ class SearchController extends AbstractController
{
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search/advanced/{name}", name="chill_main_advanced_search")
*/
public function advancedSearchAction($name, Request $request)
{
try {
@@ -85,6 +88,9 @@ class SearchController extends AbstractController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search/advanced", name="chill_main_advanced_search_list")
*/
public function advancedSearchListAction(Request $request)
{
/** @var Chill\MainBundle\Search\SearchProvider $variable */
@@ -101,6 +107,9 @@ class SearchController extends AbstractController
return $this->render('@ChillMain/Search/choose_list.html.twig');
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search.{_format}", name="chill_main_search", requirements={"_format"="html|json"}, defaults={"_format"="html"})
*/
public function searchAction(Request $request, $_format)
{
$pattern = trim((string) $request->query->get('q', ''));
@@ -190,6 +199,9 @@ class SearchController extends AbstractController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/api/1.0/search.{_format}", name="chill_main_search_global", requirements={"_format"="json"}, defaults={"_format"="json"})
*/
public function searchApi(Request $request, $_format): JsonResponse
{
//TODO this is an incomplete implementation