Search code examples
phpsymfonysymfony-routingsymfony-3.2

No route found for "GET /sf/customer-first-progam-level"


As title shows I am having that issue if I try to reach the following URL:

http://app.local/sf/customer-first-progam-level

This is what I have:

  • app/routing.yml

    quote:
        resource: "@QuoteBundle/Controller/"
        type:     annotation
        prefix:   /sf
    
  • QuoteBundle/Controller/CustomerFirstProgramLevelController.php

    <?php
    
    namespace QuoteBundle\Controller;
    
    use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
    use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
    use Symfony\Bundle\FrameworkBundle\Controller\Controller;
    use Symfony\Component\HttpFoundation\Request;
    
    /**
     * @Route("customer-first-program-level")
     */
     class CustomerFirstProgramLevelController extends Controller
     {
        use GridBuilder;
    
        /**
         * @Route("/", name="customer_first_program_level_index")
         * @Method({"GET", "POST"})
         * @param Request $request
         *
         * @return \Symfony\Component\HttpFoundation\Response
         * @throws \LogicException
         */
         public function indexAction(Request $request)
         {
             ...
         }
     }
    

This is what I have tried without success:

  • Clear the cache both prod and dev
  • Change the route name to something else

If I debug the router I got the following:

$ symfony_console debug:router
 ------------------------------------ ---------- -------- ------ -------------------------------------------- 
  Name                                 Method     Scheme   Host   Path                                        
 ------------------------------------ ---------- -------- ------ --------------------------------------------                          
  customer_index                       GET|POST   ANY      ANY    /sf/customer/                               
  customer_first_program_level_index   GET|POST   ANY      ANY    /sf/customer-first-program-level/           
  discount_index                       GET|POST   ANY      ANY    /sf/discount/                               
  ....          
 ------------------------------------ ---------- -------- ------ --------------------------------------------

I am using Symfony 3.2.7. Any ideas? I am out of them


Solution

  • I'll answer myself and apologies for those who tried to answer but the issue was so dummy that no one found it (included myself). If you take a closer look to my test URL and the route definition you'll see there was a typo on the URL:

    • URL: /sf/customer-first-progam-level
    • @Route: customer-first-program-level

    Problem progam (URL) vs program (route definition)