FOSRestBundle
FOSRestBundle copied to clipboard
ParamFetcher parameter conflicts with a path parameter 'page' for route 'route_name'
I get that exception
ParamFetcher parameter conflicts with a path parameter 'page' for route 'route_name'
500 Internal Server Error - InvalidArgumentException
vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/EventListener/ParamFetcherListener.php at line 67
with my route:
/**
* @Rest\QueryParam(name="page", requirements="\d+", description="Page of the overview.")
*
* @Rest\Get("/{page}")
*
* @param string $page
*/
public function getItemsAction($page)
{
I've
fos_rest:
param_fetcher_listener: force
Does this not work for a route pattern with a placeholder {page}
?
Ok, got it. Have to define the requirements
in the @Rest\Get
annotation. Unfortunately, that annotation does not support descriptions
or something like that.
Unfortunately, that issue still persists for me, but now with a non-path parameter withAcl
.
My route:
/**
* @ApiDoc(
* description="Returns a single object item"
* )
*
* @Rest\QueryParam(name="fields", requirements=".+", description="Fields to select")
* @Rest\QueryParam(name="withAcl", requirements=".+", default=false, description="With ACL information")
*
* @Rest\View()
* @Rest\Get("/{pk}", requirements={"pk" = ".+"})
*
* @param string $pk
* @param string $fields
* @param boolean $withAcl
*
* @return array
*/
public function getItemAction($pk, $fields = null, $withAcl = false)
{
Same Exception as abov:
ParamFetcher parameter conflicts with a path parameter 'withAcl' for route 'route_name'
Anyone a idea how to fix that?
Temporarily fixed with
... , $withAcl = null)
But shouldn't it be possible to set default values, or should those php default values are replaced with those in @QueryParam
&Co?
yeah .. i guess it would be good to make this work. i guess if the defaults match there is no reason to complain about the conflict