mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
adapt UI and controller for Person without centers
This commit is contained in:
@@ -230,13 +230,16 @@ final class PersonController extends AbstractController
|
||||
*/
|
||||
public function newAction(Request $request)
|
||||
{
|
||||
$defaultCenter = $this->security
|
||||
->getUser()
|
||||
->getGroupCenters()[0]
|
||||
->getCenter();
|
||||
$person = new Person();
|
||||
|
||||
$person = (new Person(new \DateTime('now')))
|
||||
->setCenter($defaultCenter);
|
||||
if (1 === count($this->security->getUser()
|
||||
->getGroupCenters())) {
|
||||
$person->setCenter(
|
||||
$this->security->getUser()
|
||||
->getGroupCenters()[0]
|
||||
->getCenter()
|
||||
);
|
||||
}
|
||||
|
||||
$form = $this->createForm(CreationPersonType::class, $person, [
|
||||
'validation_groups' => ['create']
|
||||
|
Reference in New Issue
Block a user