Created
June 20, 2023 18:07
-
-
Save ducho/a17c97f29bcaf4219a3c67c4a4bc8232 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[Route('/{id}/edit', name: 'airport_edit', methods: ['GET', 'POST'])] | |
public function edit(Request $request, Airport $airport): Response | |
{ | |
$form = $this->createForm(AirportType::class, $airport); | |
$form->handleRequest($request); | |
if ($form->isSubmitted() && $form->isValid()) { | |
$this->entityManager->flush(); | |
return $this->redirectOrResponse($request); | |
} | |
$template = $request->isXmlHttpRequest() ? '_form.html.twig' : 'edit.html.twig'; | |
return $this->renderForm('counter/airport/' . $template, [ | |
'form' => $form, | |
], $this->getResponse($form)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment