mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 22:04:23 +00:00
Fix routes and use annotations.
This commit is contained in:
parent
174d873398
commit
e9a7a05fb7
@ -1,123 +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_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
|
|
||||||
options:
|
|
||||||
menus:
|
|
||||||
person:
|
|
||||||
order: 60
|
|
||||||
label: Timeline
|
|
||||||
|
|
||||||
chill_person_admin:
|
|
||||||
path: "/{_locale}/admin/person"
|
|
||||||
controller: Chill\PersonBundle\Controller\AdminController::indexAction
|
|
||||||
|
|
||||||
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_closingmotive_admin:
|
chill_person_closingmotive_admin:
|
||||||
path: /{_locale}/admin/closing-motive
|
path: /{_locale}/admin/closing-motive
|
||||||
controller: cscrud_closing_motive_controller:index
|
controller: cscrud_closing_motive_controller:index
|
||||||
@ -137,5 +17,5 @@ chill_person_maritalstatus_admin:
|
|||||||
label: 'person_admin.marital status'
|
label: 'person_admin.marital status'
|
||||||
|
|
||||||
chill_person_controllers:
|
chill_person_controllers:
|
||||||
resource: "@ChillPersonBundle/Controller"
|
resource: "../src/Controller"
|
||||||
type: annotation
|
type: annotation
|
||||||
|
@ -47,12 +47,12 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
* @var EventDispatcherInterface
|
* @var EventDispatcherInterface
|
||||||
*/
|
*/
|
||||||
protected $eventDispatcher;
|
protected $eventDispatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ValidatorInterface
|
* @var ValidatorInterface
|
||||||
*/
|
*/
|
||||||
protected $validator;
|
protected $validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccompanyingPeriodController constructor.
|
* AccompanyingPeriodController constructor.
|
||||||
*
|
*
|
||||||
@ -64,11 +64,17 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->validator = $validator;
|
$this->validator = $validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_accompanying_period_list",
|
||||||
|
* path="/{_locale}/person/{person_id}/accompanying-period"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function listAction(int $person_id): Response
|
public function listAction(int $person_id): Response
|
||||||
{
|
{
|
||||||
$person = $this->_getPerson($person_id);
|
$person = $this->_getPerson($person_id);
|
||||||
|
|
||||||
$event = new PrivacyEvent($person, [
|
$event = new PrivacyEvent($person, [
|
||||||
'element_class' => AccompanyingPeriod::class,
|
'element_class' => AccompanyingPeriod::class,
|
||||||
'action' => 'list'
|
'action' => 'list'
|
||||||
@ -80,7 +86,13 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
'person' => $person
|
'person' => $person
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_accompanying_period_create",
|
||||||
|
* path="/{_locale}/person/{person_id}/accompanying-period/create"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function createAction(int $person_id, Request $request): Response
|
public function createAction(int $person_id, Request $request): Response
|
||||||
{
|
{
|
||||||
$person = $this->_getPerson($person_id);
|
$person = $this->_getPerson($person_id);
|
||||||
@ -90,17 +102,17 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
|
|
||||||
$accompanyingPeriod = new AccompanyingPeriod(new \DateTime('now'));
|
$accompanyingPeriod = new AccompanyingPeriod(new \DateTime('now'));
|
||||||
$accompanyingPeriod->setClosingDate(new \DateTime('now'));
|
$accompanyingPeriod->setClosingDate(new \DateTime('now'));
|
||||||
|
|
||||||
$accompanyingPeriod->addPerson($person);
|
$accompanyingPeriod->addPerson($person);
|
||||||
//or $person->addAccompanyingPeriod($accompanyingPeriod);
|
//or $person->addAccompanyingPeriod($accompanyingPeriod);
|
||||||
|
|
||||||
$form = $this->createForm(
|
$form = $this->createForm(
|
||||||
AccompanyingPeriodType::class,
|
AccompanyingPeriodType::class,
|
||||||
$accompanyingPeriod, [
|
$accompanyingPeriod, [
|
||||||
'period_action' => 'create',
|
'period_action' => 'create',
|
||||||
'center' => $person->getCenter()
|
'center' => $person->getCenter()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($request->getMethod() === 'POST') {
|
if ($request->getMethod() === 'POST') {
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
$errors = $this->_validatePerson($person);
|
$errors = $this->_validatePerson($person);
|
||||||
@ -120,7 +132,7 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
$this->generateUrl('chill_person_accompanying_period_list', [
|
$this->generateUrl('chill_person_accompanying_period_list', [
|
||||||
'person_id' => $person->getId()
|
'person_id' => $person->getId()
|
||||||
]));
|
]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$flashBag->add('error', $this->get('translator')
|
$flashBag->add('error', $this->get('translator')
|
||||||
->trans('Error! Period not created!'));
|
->trans('Error! Period not created!'));
|
||||||
@ -137,9 +149,12 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
'accompanying_period' => $accompanyingPeriod
|
'accompanying_period' => $accompanyingPeriod
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @Route(
|
||||||
|
* name="chill_person_accompanying_period_update",
|
||||||
|
* path="/{_locale}/person/{person_id}/accompanying-period/{period_id}/update"
|
||||||
|
* )
|
||||||
*/
|
*/
|
||||||
public function updateAction(int $person_id, int $period_id, Request $request): Response
|
public function updateAction(int $person_id, int $period_id, Request $request): Response
|
||||||
{
|
{
|
||||||
@ -154,7 +169,7 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
|
|
||||||
/** @var Person $person */
|
/** @var Person $person */
|
||||||
$person = $this->_getPerson($person_id);
|
$person = $this->_getPerson($person_id);
|
||||||
|
|
||||||
// CHECK
|
// CHECK
|
||||||
if (! $accompanyingPeriod->containsPerson($person)) {
|
if (! $accompanyingPeriod->containsPerson($person)) {
|
||||||
throw new Exception("Accompanying period " . $period_id . " does not contain person " . $person_id);
|
throw new Exception("Accompanying period " . $period_id . " does not contain person " . $person_id);
|
||||||
@ -176,7 +191,7 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
|
|
||||||
if ($form->isValid(['Default', 'closed'])
|
if ($form->isValid(['Default', 'closed'])
|
||||||
&& count($errors) === 0) {
|
&& count($errors) === 0) {
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$flashBag->add('success',
|
$flashBag->add('success',
|
||||||
@ -186,9 +201,9 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
$this->generateUrl('chill_person_accompanying_period_list', [
|
$this->generateUrl('chill_person_accompanying_period_list', [
|
||||||
'person_id' => $person->getId()
|
'person_id' => $person->getId()
|
||||||
]));
|
]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$flashBag->add('error', $this->get('translator')
|
$flashBag->add('error', $this->get('translator')
|
||||||
->trans('Error when updating the period'));
|
->trans('Error when updating the period'));
|
||||||
|
|
||||||
@ -204,19 +219,22 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
'accompanying_period' => $accompanyingPeriod
|
'accompanying_period' => $accompanyingPeriod
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \Exception
|
* @Route(
|
||||||
|
* name="chill_person_accompanying_period_close",
|
||||||
|
* path="/{_locale}/person/{person_id}/accompanying-period/close"
|
||||||
|
* )
|
||||||
*/
|
*/
|
||||||
public function closeAction(int $person_id, Request $request): Response
|
public function closeAction(int $person_id, Request $request): Response
|
||||||
{
|
{
|
||||||
|
|
||||||
$person = $this->_getPerson($person_id);
|
$person = $this->_getPerson($person_id);
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person, 'You are not allowed to update this person');
|
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person, 'You are not allowed to update this person');
|
||||||
|
|
||||||
if ($person->isOpen() === false) {
|
if ($person->isOpen() === false) {
|
||||||
|
|
||||||
$this->get('session')->getFlashBag()
|
$this->get('session')->getFlashBag()
|
||||||
->add('error', $this->get('translator')
|
->add('error', $this->get('translator')
|
||||||
->trans('Beware period is closed', ['%name%' => $person->__toString()]
|
->trans('Beware period is closed', ['%name%' => $person->__toString()]
|
||||||
@ -229,7 +247,7 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$current = $person->getCurrentAccompanyingPeriod();
|
$current = $person->getCurrentAccompanyingPeriod();
|
||||||
|
|
||||||
$form = $this->createForm(AccompanyingPeriodType::class, $current, [
|
$form = $this->createForm(AccompanyingPeriodType::class, $current, [
|
||||||
'period_action' => 'close',
|
'period_action' => 'close',
|
||||||
'center' => $person->getCenter()
|
'center' => $person->getCenter()
|
||||||
@ -256,7 +274,7 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
'person_id' => $person->getId()
|
'person_id' => $person->getId()
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->get('session')->getFlashBag()
|
$this->get('session')->getFlashBag()
|
||||||
->add('error', $this->get('translator')
|
->add('error', $this->get('translator')
|
||||||
@ -267,7 +285,7 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
->add('info', $error->getMessage());
|
->add('info', $error->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { //if form is not valid
|
} else { //if form is not valid
|
||||||
$this->get('session')->getFlashBag()
|
$this->get('session')->getFlashBag()
|
||||||
->add('error',
|
->add('error',
|
||||||
@ -288,7 +306,7 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
'accompanying_period' => $current
|
'accompanying_period' => $current
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _validatePerson(Person $person): ConstraintViolationListInterface
|
private function _validatePerson(Person $person): ConstraintViolationListInterface
|
||||||
{
|
{
|
||||||
$errors = $this->validator->validate($person, null,
|
$errors = $this->validator->validate($person, null,
|
||||||
@ -296,10 +314,10 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
|
|
||||||
// Can be disabled with config
|
// Can be disabled with config
|
||||||
if (false === $this->container->getParameter('chill_person.allow_multiple_simultaneous_accompanying_periods')) {
|
if (false === $this->container->getParameter('chill_person.allow_multiple_simultaneous_accompanying_periods')) {
|
||||||
|
|
||||||
$errors_accompanying_period = $this->validator->validate($person, null,
|
$errors_accompanying_period = $this->validator->validate($person, null,
|
||||||
['accompanying_period_consistent']);
|
['accompanying_period_consistent']);
|
||||||
|
|
||||||
foreach($errors_accompanying_period as $error ) {
|
foreach($errors_accompanying_period as $error ) {
|
||||||
$errors->add($error);
|
$errors->add($error);
|
||||||
}
|
}
|
||||||
@ -307,7 +325,13 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
|
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_accompanying_period_open",
|
||||||
|
* path="/{_locale}/person/{person_id}/accompanying-period/open"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function openAction(int $person_id, Request $request): Response
|
public function openAction(int $person_id, Request $request): Response
|
||||||
{
|
{
|
||||||
$person = $this->_getPerson($person_id);
|
$person = $this->_getPerson($person_id);
|
||||||
@ -384,7 +408,13 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
'accompanying_period' => $accompanyingPeriod
|
'accompanying_period' => $accompanyingPeriod
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_accompanying_period_re_open",
|
||||||
|
* path="/{_locale}/person/{person_id}/accompanying-period/re-open"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function reOpenAction(int $person_id, int $period_id, Request $request): Response
|
public function reOpenAction(int $person_id, int $period_id, Request $request): Response
|
||||||
{
|
{
|
||||||
/** @var Person $person */
|
/** @var Person $person */
|
||||||
@ -417,13 +447,13 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
return $this->redirectToRoute('chill_person_accompanying_period_list', [
|
return $this->redirectToRoute('chill_person_accompanying_period_list', [
|
||||||
'person_id' => $person->getId()
|
'person_id' => $person->getId()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} elseif ($confirm === false && $period->canBeReOpened($person)) {
|
} elseif ($confirm === false && $period->canBeReOpened($person)) {
|
||||||
return $this->render('ChillPersonBundle:AccompanyingPeriod:re_open.html.twig', [
|
return $this->render('ChillPersonBundle:AccompanyingPeriod:re_open.html.twig', [
|
||||||
'period' => $period,
|
'period' => $period,
|
||||||
'person' => $person
|
'person' => $person
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return (new Response())
|
return (new Response())
|
||||||
->setStatusCode(Response::HTTP_BAD_REQUEST)
|
->setStatusCode(Response::HTTP_BAD_REQUEST)
|
||||||
|
@ -13,16 +13,29 @@ use Symfony\Component\Routing\Annotation\Route;
|
|||||||
class AdminController extends AbstractController
|
class AdminController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param $_locale
|
* @Route(
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
* name="chill_person_admin",
|
||||||
|
* path="/{_locale}/admin/person"
|
||||||
|
* )
|
||||||
*/
|
*/
|
||||||
public function indexAction($_locale)
|
public function indexAction($_locale)
|
||||||
{
|
{
|
||||||
return $this->render('ChillPersonBundle:Admin:layout.html.twig', []);
|
return $this->render('ChillPersonBundle:Admin:layout.html.twig', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
* @Route(
|
||||||
|
* name="chill_person_admin_redirect_to_admin_index",
|
||||||
|
* path="/{_locale}/admin/person_redirect_to_main",
|
||||||
|
* options={
|
||||||
|
* menus={
|
||||||
|
* admin_person={
|
||||||
|
* order="0",
|
||||||
|
* label="Main admin menu"
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* )
|
||||||
*/
|
*/
|
||||||
public function redirectToAdminIndexAction()
|
public function redirectToAdminIndexAction()
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,7 @@ use Chill\MainBundle\Entity\Address;
|
|||||||
use Doctrine\Common\Collections\Criteria;
|
use Doctrine\Common\Collections\Criteria;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PersonAddressController
|
* Class PersonAddressController
|
||||||
@ -45,7 +46,7 @@ class PersonAddressController extends AbstractController
|
|||||||
* @var ValidatorInterface
|
* @var ValidatorInterface
|
||||||
*/
|
*/
|
||||||
protected $validator;
|
protected $validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PersonAddressController constructor.
|
* PersonAddressController constructor.
|
||||||
*
|
*
|
||||||
@ -55,7 +56,13 @@ class PersonAddressController extends AbstractController
|
|||||||
{
|
{
|
||||||
$this->validator = $validator;
|
$this->validator = $validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_address_list",
|
||||||
|
* path="/{_locale}/person/{person_id}/address/list"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function listAction($person_id)
|
public function listAction($person_id)
|
||||||
{
|
{
|
||||||
$person = $this->getDoctrine()->getManager()
|
$person = $this->getDoctrine()->getManager()
|
||||||
@ -78,6 +85,13 @@ class PersonAddressController extends AbstractController
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_address_create",
|
||||||
|
* path="/{_locale}/person/{person_id}/address/create",
|
||||||
|
* methods={"POST"}
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function newAction($person_id)
|
public function newAction($person_id)
|
||||||
{
|
{
|
||||||
$person = $this->getDoctrine()->getManager()
|
$person = $this->getDoctrine()->getManager()
|
||||||
@ -105,6 +119,12 @@ class PersonAddressController extends AbstractController
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_address_new",
|
||||||
|
* path="/{_locale}/person/{person_id}/address/new"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function createAction($person_id, Request $request)
|
public function createAction($person_id, Request $request)
|
||||||
{
|
{
|
||||||
$person = $this->getDoctrine()->getManager()
|
$person = $this->getDoctrine()->getManager()
|
||||||
@ -161,6 +181,12 @@ class PersonAddressController extends AbstractController
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_address_edit",
|
||||||
|
* path="/{_locale}/person/{person_id}/address/{address_id}/edit"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function editAction($person_id, $address_id)
|
public function editAction($person_id, $address_id)
|
||||||
{
|
{
|
||||||
$person = $this->getDoctrine()->getManager()
|
$person = $this->getDoctrine()->getManager()
|
||||||
@ -189,6 +215,12 @@ class PersonAddressController extends AbstractController
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_address_update",
|
||||||
|
* path="/{_locale}/person/{person_id}/address/{address_id}/update"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function updateAction($person_id, $address_id, Request $request)
|
public function updateAction($person_id, $address_id, Request $request)
|
||||||
{
|
{
|
||||||
$person = $this->getDoctrine()->getManager()
|
$person = $this->getDoctrine()->getManager()
|
||||||
|
@ -41,6 +41,7 @@ use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
|
|||||||
use Chill\PersonBundle\Repository\PersonNotDuplicateRepository;
|
use Chill\PersonBundle\Repository\PersonNotDuplicateRepository;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
final class PersonController extends AbstractController
|
final class PersonController extends AbstractController
|
||||||
{
|
{
|
||||||
@ -118,6 +119,12 @@ final class PersonController extends AbstractController
|
|||||||
return $cFGroup;
|
return $cFGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_view",
|
||||||
|
* path="/{_locale}/person/{person_id}/general"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function viewAction($person_id)
|
public function viewAction($person_id)
|
||||||
{
|
{
|
||||||
$person = $this->_getPerson($person_id);
|
$person = $this->_getPerson($person_id);
|
||||||
@ -141,6 +148,12 @@ final class PersonController extends AbstractController
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_general_edit",
|
||||||
|
* path="/{_locale}/person/{person_id}/general/edit"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function editAction($person_id)
|
public function editAction($person_id)
|
||||||
{
|
{
|
||||||
$person = $this->_getPerson($person_id);
|
$person = $this->_getPerson($person_id);
|
||||||
@ -164,6 +177,12 @@ final class PersonController extends AbstractController
|
|||||||
array('person' => $person, 'form' => $form->createView()));
|
array('person' => $person, 'form' => $form->createView()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_general_update",
|
||||||
|
* path="/{_locale}/person/{person_id}/general/update"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function updateAction($person_id, Request $request)
|
public function updateAction($person_id, Request $request)
|
||||||
{
|
{
|
||||||
$person = $this->_getPerson($person_id);
|
$person = $this->_getPerson($person_id);
|
||||||
@ -207,6 +226,12 @@ final class PersonController extends AbstractController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_new",
|
||||||
|
* path="/{_locale}/person/new"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function newAction()
|
public function newAction()
|
||||||
{
|
{
|
||||||
// this is a dummy default center.
|
// this is a dummy default center.
|
||||||
@ -291,6 +316,12 @@ final class PersonController extends AbstractController
|
|||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_review",
|
||||||
|
* path="/{_locale}/person/review"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function reviewAction(Request $request, PersonNotDuplicateRepository $personNotDuplicateRepository)
|
public function reviewAction(Request $request, PersonNotDuplicateRepository $personNotDuplicateRepository)
|
||||||
{
|
{
|
||||||
if ($request->getMethod() !== 'POST') {
|
if ($request->getMethod() !== 'POST') {
|
||||||
@ -367,6 +398,12 @@ final class PersonController extends AbstractController
|
|||||||
'form' => $form->createView()));
|
'form' => $form->createView()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_create",
|
||||||
|
* path="/{_locale}/person/create"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function createAction(Request $request)
|
public function createAction(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ use Chill\PersonBundle\Privacy\PrivacyEvent;
|
|||||||
use Chill\PersonBundle\Repository\PersonRepository;
|
use Chill\PersonBundle\Repository\PersonRepository;
|
||||||
use Chill\PersonBundle\Search\SimilarPersonMatcher;
|
use Chill\PersonBundle\Search\SimilarPersonMatcher;
|
||||||
use http\Exception\InvalidArgumentException;
|
use http\Exception\InvalidArgumentException;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Translation\TranslatorInterface;
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
@ -21,8 +20,9 @@ use Chill\DocStoreBundle\Entity\PersonDocument;
|
|||||||
use Chill\EventBundle\Entity\Participation;
|
use Chill\EventBundle\Entity\Participation;
|
||||||
use Chill\PersonBundle\Repository\PersonNotDuplicateRepository;
|
use Chill\PersonBundle\Repository\PersonNotDuplicateRepository;
|
||||||
use Chill\TaskBundle\Entity\SingleTask;
|
use Chill\TaskBundle\Entity\SingleTask;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
|
||||||
class PersonDuplicateController extends Controller
|
class PersonDuplicateController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var \Chill\PersonBundle\Search\SimilarPersonMatcher
|
* @var \Chill\PersonBundle\Search\SimilarPersonMatcher
|
||||||
@ -63,6 +63,12 @@ class PersonDuplicateController extends Controller
|
|||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_duplicate_view",
|
||||||
|
* path="/{_locale}/person/{person_id}/duplicate/view"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function viewAction($person_id, PersonNotDuplicateRepository $personNotDuplicateRepository)
|
public function viewAction($person_id, PersonNotDuplicateRepository $personNotDuplicateRepository)
|
||||||
{
|
{
|
||||||
$person = $this->_getPerson($person_id);
|
$person = $this->_getPerson($person_id);
|
||||||
@ -86,6 +92,12 @@ class PersonDuplicateController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_duplicate_confirm",
|
||||||
|
* path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function confirmAction($person1_id, $person2_id, Request $request)
|
public function confirmAction($person1_id, $person2_id, Request $request)
|
||||||
{
|
{
|
||||||
if ($person1_id === $person2_id) {
|
if ($person1_id === $person2_id) {
|
||||||
@ -143,6 +155,12 @@ class PersonDuplicateController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_duplicate_not_duplicate",
|
||||||
|
* path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/not-duplicate"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function notDuplicateAction($person1_id, $person2_id)
|
public function notDuplicateAction($person1_id, $person2_id)
|
||||||
{
|
{
|
||||||
[$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id);
|
[$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id);
|
||||||
@ -166,6 +184,12 @@ class PersonDuplicateController extends Controller
|
|||||||
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
|
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_remove_duplicate_not_duplicate",
|
||||||
|
* path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/remove-not-duplicate"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function removeNotDuplicateAction($person1_id, $person2_id)
|
public function removeNotDuplicateAction($person1_id, $person2_id)
|
||||||
{
|
{
|
||||||
[$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id);
|
[$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id);
|
||||||
@ -184,6 +208,12 @@ class PersonDuplicateController extends Controller
|
|||||||
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
|
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_find_manually_duplicate",
|
||||||
|
* path="/{_locale}/person/{person_id}/find-manually"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function findManuallyDuplicateAction($person_id, Request $request)
|
public function findManuallyDuplicateAction($person_id, Request $request)
|
||||||
{
|
{
|
||||||
$person = $this->_getPerson($person_id);
|
$person = $this->_getPerson($person_id);
|
||||||
|
@ -27,6 +27,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
use Chill\MainBundle\Timeline\TimelineBuilder;
|
use Chill\MainBundle\Timeline\TimelineBuilder;
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TimelinePersonController
|
* Class TimelinePersonController
|
||||||
@ -68,8 +69,21 @@ class TimelinePersonController extends AbstractController
|
|||||||
$this->timelineBuilder = $timelineBuilder;
|
$this->timelineBuilder = $timelineBuilder;
|
||||||
$this->paginatorFactory = $paginatorFactory;
|
$this->paginatorFactory = $paginatorFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* name="chill_person_timeline",
|
||||||
|
* path="/{_locale}/person/{person_id}/timeline",
|
||||||
|
* options={
|
||||||
|
* menus={
|
||||||
|
* person={
|
||||||
|
* order="60",
|
||||||
|
* label="Timeline"
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* )
|
||||||
|
*/
|
||||||
public function personAction(Request $request, $person_id)
|
public function personAction(Request $request, $person_id)
|
||||||
{
|
{
|
||||||
$person = $this->getDoctrine()
|
$person = $this->getDoctrine()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user