I'm able to get GET parameters with @QueryParam()
annotation, but it looks like it works for Query String data only: /user?id=123
.
I'd prefer to have it like /user/123
instead. For this, I might use @Get("/user/{id}")
annotation, but I don't see it has additional metadata which @QueryParam()
has:
name="id", requirements="\d+", default="1", description="User id"
If I use both of the annotations, I get an error:
ParamFetcher parameter conflicts with a path parameter 'id' for route 'getone'
My conflicting docblock:
/**
* 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 an id in the path (/user/123
), not in query, and I also need to use @QueryParam()
as it's read by NelmioApiDocBundle. How may I resolve this issue?
@Get
and@ApiDoc
. – Ment