mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-11-22 20:07:47 +00:00
Add external identifiers for person, editable in edit form, with minimal features associated
This commit is contained in:
@@ -17,7 +17,6 @@ use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Form\CreationPersonType;
|
||||
use Chill\PersonBundle\Form\PersonType;
|
||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||
use Chill\PersonBundle\Repository\PersonRepository;
|
||||
use Chill\PersonBundle\Search\SimilarPersonMatcher;
|
||||
@@ -49,56 +48,6 @@ final class PersonController extends AbstractController
|
||||
private readonly EntityManagerInterface $em,
|
||||
) {}
|
||||
|
||||
#[Route(path: '/{_locale}/person/{person_id}/general/edit', name: 'chill_person_general_edit')]
|
||||
public function editAction(int $person_id, Request $request)
|
||||
{
|
||||
$person = $this->_getPerson($person_id);
|
||||
|
||||
if (null === $person) {
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted(
|
||||
'CHILL_PERSON_UPDATE',
|
||||
$person,
|
||||
'You are not allowed to edit this person'
|
||||
);
|
||||
|
||||
$form = $this->createForm(
|
||||
PersonType::class,
|
||||
$person,
|
||||
[
|
||||
'cFGroup' => $this->getCFGroup(),
|
||||
]
|
||||
);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && !$form->isValid()) {
|
||||
$this->get('session')
|
||||
->getFlashBag()->add('error', $this->translator
|
||||
->trans('This form contains errors'));
|
||||
} elseif ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->em->flush();
|
||||
|
||||
$this->get('session')->getFlashBag()
|
||||
->add(
|
||||
'success',
|
||||
$this->translator
|
||||
->trans('The person data has been updated')
|
||||
);
|
||||
|
||||
return $this->redirectToRoute('chill_person_view', [
|
||||
'person_id' => $person->getId(),
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'@ChillPerson/Person/edit.html.twig',
|
||||
['person' => $person, 'form' => $form->createView()]
|
||||
);
|
||||
}
|
||||
|
||||
public function getCFGroup()
|
||||
{
|
||||
$cFGroup = null;
|
||||
|
||||
Reference in New Issue
Block a user