I can get the GET parameters with @QueryParam() annotation, but it looks like it only works for Query data String: /user?id=123 .
I would prefer it to be like /user/123 . I could use the @Get("/user/{id}") annotation @Get("/user/{id}") , but I donβt see that it has additional metadata that @QueryParam() has:
name="id", requirements="\d+", default="1", description="User id"
If I use both annotations, I get an error:
ParamFetcher parameter conflicts with a path parameter 'id' for route 'getone'
My conflicting dock block:
/** * Finds and displays a Users entity. * * @Rest\View * @Rest\Get("/user/{id}") * @Rest\QueryParam(name="id", requirements="\d+", default="1", description="User id") * @ApiDoc(section="Partner Users") * @param int $id * @return array */
PS I need to have the identifier in the path ( /user/123 ) and not in the request, and I also need to use @QueryParam() as it is read by NelmioApiDocBundle. How can I solve this problem?
symfony fosrestbundle
Roman newaza
source share