bumpi
This commit is contained in:
parent
bbc56a9af7
commit
1f9562d36b
13 changed files with 525 additions and 507 deletions
|
@ -14,6 +14,23 @@ use Symfony\Component\Routing\Attribute\Route;
|
|||
#[Route('/food/vendor')]
|
||||
final class FoodVendorController extends AbstractController
|
||||
{
|
||||
#[Route('/{id}/edit', name: 'app_food_vendor_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, FoodVendor $foodVendor, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(FoodVendorType::class, $foodVendor);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_food_vendor_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('food_vendor/edit.html.twig', [
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/', name: 'app_food_vendor_index', methods: ['GET'])]
|
||||
public function index(FoodVendorRepository $foodVendorRepository): Response
|
||||
{
|
||||
|
@ -51,21 +68,4 @@ final class FoodVendorController extends AbstractController
|
|||
'food_vendor' => $foodVendor,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_food_vendor_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, FoodVendor $foodVendor, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(FoodVendorType::class, $foodVendor);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_food_vendor_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('food_vendor/edit.html.twig', [
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue