Проблем с Route Symfony 3.2
Здравейте,
стигнах до момента в който трябва да направя admin_user_edit, от упражненията по php web fundamentals, и създадох един контролер с име UserEditController.php и в него написах:
<?php namespace MyKnowledgeBlogBundle\Controller\Admin; use MyKnowledgeBlogBundle\Entity\User; use MyKnowledgeBlogBundle\Form\UserEditType; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; class UserEditController extends Controller { /** * @Route("/edit/{id}", name="admin_user_edit") * * @param $id * @param Request $request * @return \Symfony\Component\HttpFoundation\Response */ public function editUser($id, Request $request) { $user = $this->getDoctrine()->getRepository(User::class)->find($id); if($user === null){ return $this->redirectToRoute("admin_users"); } $form = $this->createForm(UserEditType::class, $user); return $this->render('admin/user/edit.html.twig', ['user'=>$user, 'form' => $form->createView()]); } }
но когато пуснах да видя дали всичко е наред ми излезе грешка:
Fatal error: Uncaught Symfony\Component\Routing\Exception\RouteNotFoundException: Unable to generate a URL for the named route "admin_user_edit" as such route does not exist. in /home/infig7gc/public_html/test/var/cache/prod/appProdUrlGenerator.php:39 Stack trace: #0 /home/infig7gc/public_html/test/var/cache/prod/classes.php(1624): appProdUrlGenerator->generate('admin_user_edit', Array, 1) #1 /home/infig7gc/public_html/test/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php(45): Symfony\Component\Routing\Router->generate('admin_user_edit', Array, 1)
но когато проверих връзката в list.html.twig ме отвежда до правилното място.