[英]Symfony 3.4: Route Matches but no route found in url
I've just created a new controller as i usually do but, this time I got a problem with routing. 我刚刚像平常一样创建了一个新的控制器,但是这次我遇到了路由问题。
In profiler route matches but I can't reach them and get No route found for "GET /prezzi/listino"
在探查器路线匹配中,但我无法到达并获得No route found for "GET /prezzi/listino"
Controller 调节器
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route;
class PricesController extends Controller {
/**
* @Route("/prezzi/listino", name="prezzi_listino")
*/
public function pricesListAction()
{
$list = $this->getDoctrine()->getRepository('AppBundle:Prices')->findAll();
return $this->render('prices/list.html.twig', [
'items' => $list
]);
}
}
Debug Router 调试路由器
$ php bin/console debug:router
----------------------------------- ---------- -------- ------ -------------------------------------------------------
Name Method Scheme Host Path
----------------------------------- ---------- -------- ------ -------------------------------------------------------
[..]
prezzi_listino ANY ANY ANY /prezzi/listino
[..]
----------------------------------- ---------- -------- ------ -------------------------------------------------------
Router Match 路由器匹配
$ php bin/console router:match --method GET /prezzi/listino
[OK] Route "prezzi_listino" matches
+--------------+---------------------------------------------------------+
| Property | Value |
+--------------+---------------------------------------------------------+
| Route Name | prezzi_listino |
| Path | /prezzi/listino |
| Path Regex | #^/prezzi/listino$#sD |
| Host | ANY |
| Host Regex | |
| Scheme | ANY |
| Method | ANY |
| Requirements | NO CUSTOM |
| Class | Symfony\Component\Routing\Route |
| Defaults | _controller: AppBundle:Prices:pricesList |
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
| Callable | AppBundle\Controller\PricesController::pricesListAction |
+--------------+---------------------------------------------------------+
Any ideas of where is the error? 关于错误在哪里的任何想法? I think is a distraction cause I haven't see this problem. 我认为这是一种分散注意力的原因,我还没有看到这个问题。
Since I've tried to add the route in another controller that actually work, and doesn't seems to work, I've just come to the conclusion that I can't add any new route so it's meaning that is a cache error. 由于我尝试将路由添加到另一个实际起作用但似乎不起作用的控制器中,因此我得出的结论是我无法添加任何新路由,因此这意味着高速缓存错误。
Running php bin/console cache:clear --env=dev --no-warmup
solve the problem. 运行php bin/console cache:clear --env=dev --no-warmup
解决了该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.