I use Symfony2.2 and FOSRestBundle
I set
#app/config/config/yml
myapp_rest:
resource: "@MyappRestBundle/Resources/config/routing.yml"
type: rest
prefix: /v1
and
#src/Myapp/RestBundle/Resources/config/routing.yml
user:
resource: Myapp\RestBundle\Controller\UserController
type: rest
my UserController extends FOSRestController and have method cgetAction() and newAction(). And when I try to router:debug, route shows:
.. symfony routes ..
get GET ANY /v1/{id}.{_format}
new GET ANY /v1/new.{_format}
what I expected, according to the docs, is something like
"get_users" [GET] /users
what am I missing?
I suggest you read the routing docs. If you want /users you have to use getUsersAction:
public function getUsersAction() {} // "get_users" [GET] /users
Otherwise read the Implicit resource name definition section.
FOS Rest Routing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With