mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
household address: add a form for editing the validFrom date
This commit is contained in:
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Chill\MainBundle\Form\Type\AddressType;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Form\HouseholdType;
|
||||
use Chill\PersonBundle\Repository\Household\PositionRepository;
|
||||
@@ -136,6 +137,46 @@ class HouseholdController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{household_id}/address/edit_valid_from",
|
||||
* name="chill_person_household_address_valid_from_edit",
|
||||
* methods={"GET", "HEAD", "POST"}
|
||||
* )
|
||||
* @ParamConverter("household", options={"id": "household_id"})
|
||||
*/
|
||||
public function addressValidFromEdit(Request $request, Household $household)
|
||||
{
|
||||
// TODO ACL
|
||||
|
||||
$address_id = $request->query->get('address_id');
|
||||
$address = $this->getDoctrine()->getManager()
|
||||
->getRepository(Address::class)
|
||||
->find($address_id);
|
||||
|
||||
$form = $this->createForm(AddressType::class, $address, []);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->getDoctrine()->getManager()->persist($address);
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
|
||||
return $this->redirectToRoute('chill_person_household_addresses', [
|
||||
'household_id' => $household->getId()
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'@ChillPerson/Household/address_valid_from_edit.html.twig',
|
||||
[
|
||||
'household' => $household,
|
||||
'address' => $address,
|
||||
'form' => $form->createView()
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{household_id}/addresses",
|
||||
|
Reference in New Issue
Block a user