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

@@ -57,6 +57,7 @@ class AccompanyingPeriodController extends AbstractController
/**
* @throws \Exception
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/close", name="chill_person_accompanying_period_close")
*/
public function closeAction(int $person_id, Request $request): Response
{
@@ -134,6 +135,9 @@ class AccompanyingPeriodController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/create", name="chill_person_accompanying_period_create")
*/
public function createAction(int $person_id, Request $request): Response
{
$person = $this->_getPerson($person_id);
@@ -199,6 +203,7 @@ class AccompanyingPeriodController extends AbstractController
/**
* @ParamConverter("person", options={"id": "person_id"})
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period", name="chill_person_accompanying_period_list")
*/
public function listAction(Person $person): Response
{
@@ -224,6 +229,9 @@ class AccompanyingPeriodController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/open", name="chill_person_accompanying_period_open")
*/
public function openAction(int $person_id, Request $request): Response
{
$person = $this->_getPerson($person_id);
@@ -306,6 +314,9 @@ class AccompanyingPeriodController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open", name="chill_person_accompanying_period_re_open")
*/
public function reOpenAction(int $person_id, int $period_id, Request $request): Response
{
/** @var Person $person */
@@ -353,6 +364,7 @@ class AccompanyingPeriodController extends AbstractController
/**
* @throws Exception
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/{period_id}/update", name="chill_person_accompanying_period_update")
*/
public function updateAction(int $person_id, int $period_id, Request $request): Response
{

View File

@@ -53,6 +53,7 @@ class AdminController extends AbstractController
/**
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/person_redirect_to_main", name="chill_person_admin_redirect_to_admin_index", options={null})
*/
public function redirectToAdminIndexAction()
{

View File

@@ -40,6 +40,9 @@ class PersonAddressController extends AbstractController
$this->validator = $validator;
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/create", name="chill_person_address_create", methods={"POST"})
*/
public function createAction($person_id, Request $request)
{
$person = $this->getDoctrine()->getManager()
@@ -95,6 +98,9 @@ class PersonAddressController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/{address_id}/edit", name="chill_person_address_edit")
*/
public function editAction($person_id, $address_id)
{
$person = $this->getDoctrine()->getManager()
@@ -123,6 +129,9 @@ class PersonAddressController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/list", name="chill_person_address_list")
*/
public function listAction($person_id)
{
$person = $this->getDoctrine()->getManager()
@@ -145,6 +154,9 @@ class PersonAddressController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/new", name="chill_person_address_new")
*/
public function newAction($person_id)
{
$person = $this->getDoctrine()->getManager()
@@ -172,6 +184,9 @@ class PersonAddressController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/{address_id}/update", name="chill_person_address_update")
*/
public function updateAction($person_id, $address_id, Request $request)
{
$person = $this->getDoctrine()->getManager()

View File

@@ -59,6 +59,9 @@ final class PersonController extends AbstractController
) {
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/general/edit", name="chill_person_general_edit")
*/
public function editAction($person_id, Request $request)
{
$person = $this->_getPerson($person_id);
@@ -157,6 +160,7 @@ final class PersonController extends AbstractController
*
* The next post compare the data with previous one and, if yes, show a
* review page if there are "alternate persons".
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/new", name="chill_person_new")
*/
public function newAction(Request $request): Response
{
@@ -252,6 +256,9 @@ final class PersonController extends AbstractController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/general", name="chill_person_view")
*/
public function viewAction(int $person_id)
{
$person = $this->_getPerson($person_id);

View File

@@ -38,6 +38,9 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
{
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm", name="chill_person_duplicate_confirm")
*/
public function confirmAction($person1_id, $person2_id, Request $request)
{
if ($person1_id === $person2_id) {
@@ -99,6 +102,9 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/find-manually", name="chill_person_find_manually_duplicate")
*/
public function findManuallyDuplicateAction($person_id, Request $request)
{
$person = $this->_getPerson($person_id);
@@ -149,6 +155,9 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/not-duplicate", name="chill_person_duplicate_not_duplicate")
*/
public function notDuplicateAction($person1_id, $person2_id)
{
[$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id);
@@ -175,6 +184,9 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/remove-not-duplicate", name="chill_person_remove_duplicate_not_duplicate")
*/
public function removeNotDuplicateAction($person1_id, $person2_id)
{
[$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id);
@@ -196,6 +208,9 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/duplicate/view", name="chill_person_duplicate_view")
*/
public function viewAction($person_id, PersonNotDuplicateRepository $personNotDuplicateRepository)
{
$person = $this->_getPerson($person_id);

View File

@@ -29,6 +29,9 @@ final class PersonResourceController extends AbstractController
{
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/{resource_id}/delete", name="chill_person_resource_delete")
*/
public function deleteAction(Request $request, $person_id, $resource_id): Response
{
$personOwner = $this->personRepository->find($person_id);
@@ -75,6 +78,9 @@ final class PersonResourceController extends AbstractController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/{resource_id}/edit", name="chill_person_resource_edit")
*/
public function editAction(Request $request, $resource_id, $person_id): Response
{
$resource = $this->personResourceRepository->find($resource_id);
@@ -109,6 +115,9 @@ final class PersonResourceController extends AbstractController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/list", name="chill_person_resource_list")
*/
public function listAction(Request $request, $person_id)
{
$personOwner = $this->personRepository->find($person_id);
@@ -126,6 +135,9 @@ final class PersonResourceController extends AbstractController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/new", name="chill_person_resource_new")
*/
public function newAction(Request $request, $person_id)
{
$personOwner = $this->personRepository->find($person_id);

View File

@@ -26,6 +26,9 @@ class TimelinePersonController extends AbstractController
{
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/timeline", name="chill_person_timeline")
*/
public function personAction(Request $request, $person_id)
{
$person = $this->getDoctrine()

View File

@@ -62,8 +62,6 @@ final class PersonDuplicateControllerViewTest extends WebTestCase
/**
* @dataProvider providePersonData
* @param int $personId
* @param int $person2Id
* @return void
*/
public function testViewDuplicatePerson(int $personId, int $person2Id): void

View File

@@ -1,130 +1,3 @@
chill_person_view:
path: /{_locale}/person/{person_id}/general
controller: Chill\PersonBundle\Controller\PersonController::viewAction
chill_person_general_edit:
path: /{_locale}/person/{person_id}/general/edit
controller: Chill\PersonBundle\Controller\PersonController::editAction
chill_person_general_update:
path: /{_locale}/person/{person_id}/general/update
controller: Chill\PersonBundle\Controller\PersonController::updateAction
chill_person_new:
path: /{_locale}/person/new
controller: Chill\PersonBundle\Controller\PersonController::newAction
chill_person_review:
path: /{_locale}/person/review
controller: Chill\PersonBundle\Controller\PersonController::reviewAction
chill_person_create:
path: /{_locale}/person/create
controller: Chill\PersonBundle\Controller\PersonController::createAction
chill_person_search:
path: /{_locale}/person/search
controller: Chill\PersonBundle\Controller\PersonController::searchAction
options:
menus:
main:
order: 30
label: Search within persons
chill_person_accompanying_period_list:
path: /{_locale}/person/{person_id}/accompanying-period
controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::listAction
chill_person_accompanying_period_create:
path: /{_locale}/person/{person_id}/accompanying-period/create
controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::createAction
chill_person_accompanying_period_update:
path: /{_locale}/person/{person_id}/accompanying-period/{period_id}/update
controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::updateAction
chill_person_accompanying_period_close:
path: /{_locale}/person/{person_id}/accompanying-period/close
controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::closeAction
chill_person_accompanying_period_open:
path: /{_locale}/person/{person_id}/accompanying-period/open
controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::openAction
chill_person_accompanying_period_re_open:
path: /{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open
controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::reOpenAction
chill_person_resource_list:
path: /{_locale}/person/{person_id}/resources/list
controller: Chill\PersonBundle\Controller\PersonResourceController::listAction
chill_person_resource_new:
path: /{_locale}/person/{person_id}/resources/new
controller: Chill\PersonBundle\Controller\PersonResourceController::newAction
chill_person_resource_edit:
path: /{_locale}/person/{person_id}/resources/{resource_id}/edit
controller: Chill\PersonBundle\Controller\PersonResourceController::editAction
chill_person_resource_delete:
path: /{_locale}/person/{person_id}/resources/{resource_id}/delete
controller: Chill\PersonBundle\Controller\PersonResourceController::deleteAction
chill_person_address_list:
path: /{_locale}/person/{person_id}/address/list
controller: Chill\PersonBundle\Controller\PersonAddressController::listAction
chill_person_address_create:
path: /{_locale}/person/{person_id}/address/create
controller: Chill\PersonBundle\Controller\PersonAddressController::createAction
methods: [POST]
chill_person_address_new:
path: /{_locale}/person/{person_id}/address/new
controller: Chill\PersonBundle\Controller\PersonAddressController::newAction
chill_person_address_edit:
path: /{_locale}/person/{person_id}/address/{address_id}/edit
controller: Chill\PersonBundle\Controller\PersonAddressController::editAction
chill_person_address_update:
path: /{_locale}/person/{person_id}/address/{address_id}/update
controller: Chill\PersonBundle\Controller\PersonAddressController::updateAction
chill_person_timeline:
path: /{_locale}/person/{person_id}/timeline
controller: Chill\PersonBundle\Controller\TimelinePersonController::personAction
chill_person_duplicate_view:
path: /{_locale}/person/{person_id}/duplicate/view
controller: Chill\PersonBundle\Controller\PersonDuplicateController::viewAction
chill_person_duplicate_confirm:
path: /{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm
controller: Chill\PersonBundle\Controller\PersonDuplicateController::confirmAction
chill_person_duplicate_not_duplicate:
path: /{_locale}/person/{person1_id}/duplicate/{person2_id}/not-duplicate
controller: Chill\PersonBundle\Controller\PersonDuplicateController::notDuplicateAction
chill_person_remove_duplicate_not_duplicate:
path: /{_locale}/person/{person1_id}/duplicate/{person2_id}/remove-not-duplicate
controller: Chill\PersonBundle\Controller\PersonDuplicateController::removeNotDuplicateAction
chill_person_find_manually_duplicate:
path: /{_locale}/person/{person_id}/find-manually
controller: Chill\PersonBundle\Controller\PersonDuplicateController::findManuallyDuplicateAction
chill_person_admin_redirect_to_admin_index:
path: /{_locale}/admin/person_redirect_to_main
controller: Chill\PersonBundle\Controller\AdminController::redirectToAdminIndexAction
options:
menus:
admin_person:
order: 0
label: Main admin menu
chill_person_controllers:
resource: "@ChillPersonBundle/Controller"
type: annotation