Search code examples
phproutesannotationssymfony-2.8

No Route found For GET/Site/{slug}


Please help me in the case. Well, in the controller I gave the path through the annotation and after the call it shows a missing path. I checked the php app / console debug: route and my path exists. I made the cache: clear and did not help. Do you know the solution?

<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/
 -------------------------- ---------- -------- ------ -----------------------------------

Solution

  • You have problem in annotation:

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

    it shold be

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

    To many brackets - so rest was ignored - in debug:router there is Any mathod allowed, but it should be only GET