0

i am using symfony 2.2.3 with FOSRestBundle to implement Restful webservices.

here is my code but when i fire following url i am getting following error

No route found for "GET /business/john"

here is the controller code

use FOS\RestBundle\Controller\Annotations as Rest;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Symfony\Component\Security\Core\Exception\AccessDeniedException;

use FOS\RestBundle\Controller\FOSRestController;
use FOS\RestBundle\Routing\ClassResourceInterface;

class BusinessController extends Controller {


        public function getBusinessAction($para){


          return new JsonResponse(array('name' => $para));
        } 

}

here is my url

http://localhost/symfony/web/app_dev.php/business/john

here is my route

if i remove the argument from url and from function getBusinessAction then it works but not with arguments/

_business:
    resource: "@HubHomeBundle/Controller/BusinessController.php"    
    type: rest

update

inside app/confing/routing.yml

   hub_home:
    resource: "@HubHomeBundle/Resources/config/routing.yml"
Hunt
  • 8,215
  • 28
  • 116
  • 256
  • Did you register the bundle routes in app/config/routing.yml? Also in the terminal type php app/console router:debug. it will list all the routes that are available. – Onema Sep 29 '13 at 20:53
  • i have edited the question , but i dont know how to do it with `app/console router:debug` – Hunt Sep 30 '13 at 04:03

1 Answers1

1

Just to make sure, is this from HubHomeBundle/Resources/config/routing.yml?

_business:
    resource: "@HubHomeBundle/Controller/BusinessController.php"    
    type: rest

If so try editing it and changing it to:

_business:
    resource: HubHomeBundle\Controller\BusinessController   
    type: rest

The value of your 'resource' tag should be the fully qualified name of the controller Class, not the path to the file

flivan
  • 473
  • 4
  • 8
  • Go to the root of your project (Where you can see the app, web, config, logs, Resources directories) and run 'php app/console router:debug' whats your output? – flivan Oct 03 '13 at 16:51