From 3ed562e5d9f6a50325a54010b5c0829a8844167b Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 21 Apr 2022 18:23:47 +0200 Subject: [PATCH] person: create a person with address and attribute the household to the create ousehold button --- .../Controller/PersonController.php | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index e62368efe..13e22cf90 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -251,18 +251,6 @@ final class PersonController extends AbstractController $this->em->flush(); $this->lastPostDataReset(); - if ($form->get('createPeriod')->isClicked()) { - return $this->redirectToRoute('chill_person_accompanying_course_new', [ - 'person_id' => [$person->getId()], - ]); - } - - if ($form->get('createHousehold')->isClicked()) { - return $this->redirectToRoute('chill_person_household_members_editor', [ - 'persons' => [$person->getId()], - ]); - } - $address = $form->get('address')->getData(); $addressForm = $form->get('addressForm')->getData(); @@ -279,6 +267,25 @@ final class PersonController extends AbstractController $this->em->persist($member); $this->em->persist($household); $this->em->flush(); + + if ($form->get('createHousehold')->isClicked()) { + return $this->redirectToRoute('chill_person_household_members_editor', [ + 'persons' => [$person->getId()], + 'household' => $household->getId() + ]); + } + } + + if ($form->get('createPeriod')->isClicked()) { + return $this->redirectToRoute('chill_person_accompanying_course_new', [ + 'person_id' => [$person->getId()], + ]); + } + + if ($form->get('createHousehold')->isClicked()) { + return $this->redirectToRoute('chill_person_household_members_editor', [ + 'persons' => [$person->getId()], + ]); } return $this->redirectToRoute(