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

View File

@@ -2,38 +2,6 @@ chill_main_controllers:
resource: '../Controller/'
type: annotation
chill_main_admin_permissionsgroup:
resource: "@ChillMainBundle/config/routes/permissionsgroup.yaml"
prefix: "{_locale}/admin/permissionsgroup"
chill_main_admin_scope:
resource: "@ChillMainBundle/config/routes/scope.yaml"
prefix: "{_locale}/admin/scope"
chill_main_admin:
resource: "@ChillMainBundle/config/routes/center.yaml"
prefix: "{_locale}/admin/center"
chill_main_exports:
resource: "@ChillMainBundle/config/routes/exports.yaml"
prefix: "{_locale}/exports"
chill_postal_code:
resource: "@ChillMainBundle/config/routes/postal-code.yaml"
prefix: "{_locale}/postal-code"
chill_password:
resource: "@ChillMainBundle/config/routes/password.yaml"
prefix: "{_locale}/password"
chill_password_recover:
resource: "@ChillMainBundle/config/routes/password_recover.yaml"
prefix: "public/{_locale}/password"
chill_main_notification:
resource: "@ChillMainBundle/config/routes/notification.yaml"
prefix: "{_locale}/notification"
chill_crud:
resource: "@ChillMainBundle"
type: CRUD
@@ -45,50 +13,6 @@ root:
path: /homepage
permanent: false
chill_main_homepage_without_locale:
path: /homepage
controller: Chill\MainBundle\Controller\DefaultController::indexWithoutLocaleAction
chill_main_homepage:
path: /{_locale}/homepage
controller: Chill\MainBundle\Controller\DefaultController::indexAction
# chill_main_admin_central:
# path: /{_locale}/admin
# controller: Chill\MainBundle\Controller\AdminController::indexAction
# options:
# menus:
# admin_permissions:
# order: 0
# label: Main admin menu
#
chill_main_search:
path: /{_locale}/search.{_format}
controller: Chill\MainBundle\Controller\SearchController::searchAction
format: 'html' # sf4 check
requirements:
_format: html|json
chill_main_search_global:
path: '/api/1.0/search.{_format}'
controller: Chill\MainBundle\Controller\SearchController::searchApi
format: 'json'
requirements:
_format: 'json'
chill_main_advanced_search:
path: /{_locale}/search/advanced/{name}
controller: Chill\MainBundle\Controller\SearchController::advancedSearchAction
chill_main_advanced_search_list:
path: /{_locale}/search/advanced
controller: Chill\MainBundle\Controller\SearchController::advancedSearchListAction
login:
path: /login
controller: Chill\MainBundle\Controller\LoginController::loginAction
login_check:
path: /login_check

View File

@@ -1,21 +0,0 @@
admin_center:
path: /
controller: Chill\MainBundle\Controller\CenterController::indexAction
admin_center_new:
path: /new
controller: Chill\MainBundle\Controller\CenterController::newAction
admin_center_create:
path: /create
controller: Chill\MainBundle\Controller\CenterController::createAction
methods: POST
admin_center_edit:
path: /{id}/edit
controller: Chill\MainBundle\Controller\CenterController::editAction
admin_center_update:
path: /{id}/update
controller: Chill\MainBundle\Controller\CenterController::updateAction
methods: [POST, PUT]

View File

@@ -1,17 +0,0 @@
chill_main_export_index:
path: /
controller: Chill\MainBundle\Controller\ExportController::indexAction
chill_main_export_new:
path: /new/{alias}
controller: Chill\MainBundle\Controller\ExportController::newAction
chill_main_export_generate:
path: /generate/{alias}
controller: Chill\MainBundle\Controller\ExportController::generateAction
methods: [GET]
chill_main_export_download:
path: /download/{alias}
controller: Chill\MainBundle\Controller\ExportController::downloadResultAction
methods: [ GET ]

View File

@@ -1,4 +0,0 @@
change_my_password:
path: /edit
controller: Chill\MainBundle\Controller\PasswordController::userPasswordAction

View File

@@ -1,15 +0,0 @@
password_recover:
path: /recover
controller: Chill\MainBundle\Controller\PasswordController::recoverAction
password_request_recover:
path: /request-recover
controller: Chill\MainBundle\Controller\PasswordController::requestRecoverAction
password_request_recover_confirm:
path: /request-confirm
controller: Chill\MainBundle\Controller\PasswordController::requestRecoverConfirmAction
password_request_recover_changed:
path: /request-changed
controller: Chill\MainBundle\Controller\PasswordController::changeConfirmedAction

View File

@@ -1,35 +0,0 @@
admin_permissionsgroup:
path: /
controller: Chill\MainBundle\Controller\PermissionsGroupController::indexAction
admin_permissionsgroup_show:
path: /{id}/show
controller: Chill\MainBundle\Controller\PermissionsGroupController::showAction
admin_permissionsgroup_new:
path: /new
controller: Chill\MainBundle\Controller\PermissionsGroupController::newAction
admin_permissionsgroup_create:
path: /create
controller: Chill\MainBundle\Controller\PermissionsGroupController::createAction
methods: POST
admin_permissionsgroup_edit:
path: /{id}/edit
controller: Chill\MainBundle\Controller\PermissionsGroupController::editAction
admin_permissionsgroup_update:
path: /{id}/update
controller: Chill\MainBundle\Controller\PermissionsGroupController::updateAction
methods: [POST, PUT]
admin_permissionsgroup_delete_role_scope:
path: /{pgid}/delete_link_role_scope/{rsid}
controller: Chill\MainBundle\Controller\PermissionsGroupController::deleteLinkRoleScopeAction
methods: [DELETE]
admin_permissionsgroup_add_role_scope:
path: /{id}/add_link_role_scope
controller: Chill\MainBundle\Controller\PermissionsGroupController::addLinkRoleScopeAction
methods: [PUT]

View File

@@ -1,4 +0,0 @@
chill_main_postal_code_search:
path: /search
controller: Chill\MainBundle\Controller\PostalCodeController::searchAction

View File

@@ -1,21 +0,0 @@
admin_scope:
path: /
controller: Chill\MainBundle\Controller\ScopeController::indexAction
admin_scope_new:
path: /new
controller: Chill\MainBundle\Controller\ScopeController::newAction
admin_scope_create:
path: /create
controller: Chill\MainBundle\Controller\ScopeController::createAction
methods: POST
admin_scope_edit:
path: /{id}/edit
controller: Chill\MainBundle\Controller\ScopeController::editAction
admin_scope_update:
path: /{id}/update
controller: Chill\MainBundle\Controller\ScopeController::updateAction
methods: [POST, PUT]