getDoctrine() ->getRepository(::class) ->findAll(); return $this->render('/index.html.twig', [ '' => $, ]); } /** * @Route("/new", name="_new", methods={"GET","POST"}) */ public function new(Request $request): Response { $ = new (); $form = $this->createForm(::class, $); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $entityManager = $this->getDoctrine()->getManager(); $entityManager->persist($); $entityManager->flush(); return $this->redirectToRoute('_index'); } return $this->render('/new.html.twig', [ '' => $, 'form' => $form->createView(), ]); } /** * @Route("/{}/edit", name="_edit", methods={"GET","POST"}) */ public function edit(Request $request, $): Response { $form = $this->createForm(::class, $); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $this->getDoctrine()->getManager()->flush(); return $this->redirectToRoute('_index'); } return $this->render('/edit.html.twig', [ '' => $, 'form' => $form->createView(), ]); } /** * @Route("/{}/delete", name="_delete", methods={"GET"}) */ public function delete( $): Response { $entityManager = $this->getDoctrine()->getManager(); $entityManager->remove($); $entityManager->flush(); return $this->redirectToRoute('_index'); } }