render('statut_commandes/index.html.twig', [ 'statut_commandes' => $statutCommandesRepository->findAll(), ]); } #[Route('/new', name: 'app_statut_commandes_new', methods: ['GET', 'POST'])] public function new(Request $request, EntityManagerInterface $entityManager): Response { $statutCommande = new StatutCommandes(); $form = $this->createForm(StatutCommandesType::class, $statutCommande); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $entityManager->persist($statutCommande); $entityManager->flush(); return $this->redirectToRoute('app_statut_commandes_index', [], Response::HTTP_SEE_OTHER); } return $this->render('statut_commandes/new.html.twig', [ 'statut_commande' => $statutCommande, 'form' => $form, ]); } #[Route('/{id}/edit', name: 'app_statut_commandes_edit', methods: ['GET', 'POST'])] public function edit(Request $request, StatutCommandes $statutCommande, EntityManagerInterface $entityManager): Response { $form = $this->createForm(StatutCommandesType::class, $statutCommande); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $entityManager->flush(); return $this->redirectToRoute('app_statut_commandes_index', [], Response::HTTP_SEE_OTHER); } return $this->render('statut_commandes/edit.html.twig', [ 'statut_commande' => $statutCommande, 'form' => $form, ]); } #[Route('/{id}', name: 'app_statut_commandes_delete', methods: ['POST'])] public function delete(Request $request, StatutCommandes $statutCommande, EntityManagerInterface $entityManager): Response { if ($this->isCsrfTokenValid('delete'.$statutCommande->getId(), $request->getPayload()->getString('_token'))) { $entityManager->remove($statutCommande); $entityManager->flush(); } return $this->redirectToRoute('app_statut_commandes_index', [], Response::HTTP_SEE_OTHER); } }