找不到GET / Site / {slug}的路线

时间:2017-09-11 18:45:28

标签: php routing annotations symfony-2.8

请帮助我。好吧,在控制器中我通过注释给出了路径,并且在调用之后它显示了缺少的路径。我检查了php app / console debug:route和我的路径存在。我做了缓存:清楚但没有帮助。你知道解决方案吗?

<pre>
class RepController extends Controller
{
     /**
     * @Route("Single/{userStructureSymbol}"),name="Single",defaults="ZFI0")
     * @Method("GET")
     */
    public function indexAction(Request $request,$userStructureSymbol)
    {

       Someexample code here

        return $this->render('RepBundle:Default:index.html.twig', array(
            'array'=>example
        ));
    }

的routing.yml

    rep:
    resource: "@RepBundle/Controller/"
    type:     annotation
    prefix:   /Rep
 -------------------------- ---------- -------- ------ -----------------------------------
  Name                       Method     Scheme   Host   Path
 -------------------------- ---------- -------- ------ -----------------------------------
  _wdt                       ANY        ANY      ANY    /_wdt/{token}
  _profiler_home             ANY        ANY      ANY    /_profiler/
  _profiler_search           ANY        ANY      ANY    /_profiler/search
  _profiler_search_bar       ANY        ANY      ANY    /_profiler/search_bar
  _profiler_purge            ANY        ANY      ANY    /_profiler/purge
  _profiler_info             ANY        ANY      ANY    /_profiler/info/{about}
  _profiler_phpinfo          ANY        ANY      ANY    /_profiler/phpinfo
  _profiler_search_results   ANY        ANY      ANY    /_profiler/{token}/search/results
  _profiler                  ANY        ANY      ANY    /_profiler/{token}
  _profiler_router           ANY        ANY      ANY    /_profiler/{token}/router
  _profiler_exception        ANY        ANY      ANY    /_profiler/{token}/exception
  _profiler_exception_css    ANY        ANY      ANY    /_profiler/{token}/exception.css
  _twig_error_test           ANY        ANY      ANY    /_error/{code}.{_format}
  rep_rep_index              ANY        ANY      ANY    /Rep/Single{userStructureSymbol}
  index                      ANY        ANY      ANY    /
  APManager                  ANY        ANY      ANY    /APManager/{name}
  APManagerMain              ANY        ANY      ANY    /APManagerMain/{name}
  fos_user_security_login    GET|POST   ANY      ANY    /login
  fos_user_security_check    POST       ANY      ANY    /login_check
  fos_user_security_logout   GET        ANY      ANY    /logout
  fos_user_profile_show      GET        ANY      ANY    /profile/
  fos_user_profile_edit      GET|POST   ANY      ANY    /profile/edit
  easyadmin                  ANY        ANY      ANY    /admin/
  admin                      ANY        ANY      ANY    /admin/
 -------------------------- ---------- -------- ------ -----------------------------------

1 个答案:

答案 0 :(得分:1)

注释中存在问题:

@Route("Single/{userStructureSymbol}"),name="Single",defaults="ZFI0")

它应该

@Route("Single/{userStructureSymbol}",name="Single",defaults="ZFI0")

对于许多括号 - 所以休息被忽略 - 在调试中:路由器有任何允许的方法,但它应该只是GET