render('food_vendor/index.html.twig', [ 'food_vendors' => $foodVendorRepository->findAll(), ]); } #[Route('/new', name: 'app_food_vendor_new', methods: ['GET', 'POST'])] public function new( Request $request, EntityManagerInterface $entityManager ): Response { $foodVendor = new FoodVendor; $form = $this->createForm(FoodVendorType::class, $foodVendor); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $entityManager->persist($foodVendor); $entityManager->flush(); return $this->redirectToRoute('app_food_vendor_index', [], Response::HTTP_SEE_OTHER); } return $this->render('food_vendor/new.html.twig', [ 'food_vendor' => $foodVendor, 'form' => $form, ]); } #[Route('/{id}', name: 'app_food_vendor_show', methods: ['GET'])] public function show(FoodVendor $foodVendor): Response { return $this->render('food_vendor/show.html.twig', [ '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, ]); } }