namespace getNamespace() ?>; getUseStatements(); ?> #[Route('')] getClassDeclaration() ?> { generateRouteForControllerMethod('', sprintf('%s_index', $route_name), ['GET']) ?> public function index( $): Response { return $this->render('/index.html.twig', [ '' => $->findAll(), ]); } public function index(EntityManagerInterface $entityManager): Response { $ = $entityManager ->getRepository(::class) ->findAll(); return $this->render('/index.html.twig', [ '' => $, ]); } generateRouteForControllerMethod('/new', sprintf('%s_new', $route_name), ['GET', 'POST']) ?> public function new(Request $request, EntityManagerInterface $entityManager): Response { $ = new (); $form = $this->createForm(::class, $); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $entityManager->persist($); $entityManager->flush(); return $this->redirectToRoute('_index', [], Response::HTTP_SEE_OTHER); } return $this->render('/new.html.twig', [ '' => $, 'form' => $form, ]); } generateRouteForControllerMethod(sprintf('/{%s}', $entity_identifier), sprintf('%s_show', $route_name), ['GET']) ?> public function show( $): Response { return $this->render('/show.html.twig', [ '' => $, ]); } generateRouteForControllerMethod(sprintf('/{%s}/edit', $entity_identifier), sprintf('%s_edit', $route_name), ['GET', 'POST']) ?> public function edit(Request $request, $, EntityManagerInterface $entityManager): Response { $form = $this->createForm(::class, $); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $entityManager->flush(); return $this->redirectToRoute('_index', [], Response::HTTP_SEE_OTHER); } return $this->render('/edit.html.twig', [ '' => $, 'form' => $form, ]); } generateRouteForControllerMethod(sprintf('/{%s}', $entity_identifier), sprintf('%s_delete', $route_name), ['POST']) ?> public function delete(Request $request, $, EntityManagerInterface $entityManager): Response { if ($this->isCsrfTokenValid('delete'.$->get(), $request->getPayload()->getString('_token'))) { $entityManager->remove($); $entityManager->flush(); } return $this->redirectToRoute('_index', [], Response::HTTP_SEE_OTHER); } }