我已经使用注释设置了一条路线。在我看来是对的,Symfony2 说这是错误的。这是路线:
@Route("/news/{id}/{slug}", name="newsarticle")
这是我认为与路线匹配的示例 URL:
这是功能骨架:
public function newsArticleAction($id, $slug)
{
}
我在这里想念什么?我收到 500 错误,日志显示:
[2012-10-30 20:36:35] request.INFO:匹配路由“newsarticle”(参数:“_controller”:“App\SiteBundle\Controller\DefaultController::newsArticleAction”,“id”:“202”,“ slug": "my-news-title", "_route": "newsarticle") [] [] [2012-10-30 20:36:36] app.INFO: From listener: The "newsarticle" route has some missing强制参数(“id”)。[] [] [2012-10-30 20:36:36] request.CRITICAL:Symfony\Component\Routing\Exception\MissingMandatoryParametersException:“newsarticle”路由缺少一些强制参数(“id”)。(未捕获的异常)在 /home/user/app/cache/prod/classes.php 第 676 行 [] []