mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
fix validation person resource
This commit is contained in:
@@ -145,30 +145,16 @@ final class PersonResourceController extends AbstractController
|
||||
public function newAction(Request $request, $person_id)
|
||||
{
|
||||
$personOwner = $this->personRepository->find($person_id);
|
||||
$personResource = new PersonResource();
|
||||
$personResource->setPersonOwner($personOwner);
|
||||
|
||||
$form = $this->createForm(PersonResourceType::class);
|
||||
$form = $this->createForm(PersonResourceType::class, $personResource);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->denyAccessUnlessGranted(PersonVoter::CREATE, $personOwner);
|
||||
|
||||
$personResource = new PersonResource();
|
||||
|
||||
$person = $form['person']->getData();
|
||||
$thirdparty = $form['thirdparty']->getData();
|
||||
$freetext = $form['freetext']->getData();
|
||||
$comment = $form['comment']->getData();
|
||||
$kind = $form['kind']->getData();
|
||||
|
||||
$personResource->setKind($kind);
|
||||
$personResource->setPerson($person);
|
||||
$personResource->setThirdParty($thirdparty);
|
||||
$personResource->setFreeText($freetext);
|
||||
$personResource->setComment($comment);
|
||||
|
||||
$personResource->setPersonOwner($personOwner);
|
||||
|
||||
$this->em->persist($personResource);
|
||||
$this->em->flush();
|
||||
|
||||
|
Reference in New Issue
Block a user