I'm using Symfony 2.3.4 and FOSRestBundle 0.13.1. I have configured the routes to be auto-generated by the FOSRestBundle. Eveything works great until I add the @QueryParam annotation to any method. This annotation changes the route and instead of extracting the varaible from the url it expects it to be passed as a parameter.
i.e
/**
* @return array
* @Rest\View
*/
public function getDetailsAction($user) {
......
}
-bash-4.2$ php app/console router:debug
get_details GET ANY ANY /api/users/details/{user}
But as soon as I add the @QueryParam annotation, my route changes to:
/**
* @QueryParam(name="user", requirements="\w+", strict=true, nullable=false, description="Name of the user to query details for")
* @return array
* @Rest\View
*/
public function getDetailsAction($user) {
......
}
-bash-4.2$ php app/console router:debug
get_details GET ANY ANY /api/users/details
Why are my routes changing? Is it not possible to keep the original routes and use the @QueryParam annotation at the same time?