mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles
This commit is contained in:
@@ -20,7 +20,6 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use function array_filter;
|
||||
use function array_values;
|
||||
|
||||
@@ -69,13 +68,4 @@ class PersonApiController extends ApiController
|
||||
|
||||
return $this->json(array_values($addresses), Response::HTTP_OK, [], ['groups' => ['read']]);
|
||||
}
|
||||
|
||||
protected function createEntity(string $action, Request $request): object
|
||||
{
|
||||
return parent::createEntity($action, $request);
|
||||
// TODO temporary hack to allow creation of person with fake center
|
||||
/* $centers = $this->authorizationHelper->getReachableCenters($this->getUser(),
|
||||
new Role(PersonVoter::CREATE));
|
||||
$person->setCenter($centers[0]); */
|
||||
}
|
||||
}
|
||||
|
@@ -131,6 +131,8 @@ final class PersonController extends AbstractController
|
||||
->getFlashBag()->add('error', $this->translator
|
||||
->trans('This form contains errors'));
|
||||
} elseif ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->em->flush();
|
||||
|
||||
$this->get('session')->getFlashBag()
|
||||
->add(
|
||||
'success',
|
||||
@@ -138,8 +140,6 @@ final class PersonController extends AbstractController
|
||||
->trans('The person data has been updated')
|
||||
);
|
||||
|
||||
$this->em->flush();
|
||||
|
||||
return $this->redirectToRoute('chill_person_view', [
|
||||
'person_id' => $person->getId(),
|
||||
]);
|
||||
@@ -216,13 +216,12 @@ final class PersonController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
$form = $this->createForm(CreationPersonType::class, $person, [
|
||||
'validation_groups' => ['create'],
|
||||
])->add('editPerson', SubmitType::class, [
|
||||
'label' => 'Add the person',
|
||||
])->add('createPeriod', SubmitType::class, [
|
||||
'label' => 'Add the person and create an accompanying period',
|
||||
]);
|
||||
$form = $this->createForm(CreationPersonType::class, $person)
|
||||
->add('editPerson', SubmitType::class, [
|
||||
'label' => 'Add the person',
|
||||
])->add('createPeriod', SubmitType::class, [
|
||||
'label' => 'Add the person and create an accompanying period',
|
||||
]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
|
Reference in New Issue
Block a user