Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParamFetcher parameter conflicts with a path parameter 'page' for route 'route_name' #629

Open
marcj opened this issue Dec 10, 2013 · 4 comments

Comments

@marcj
Copy link

marcj commented Dec 10, 2013

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}?

@marcj
Copy link
Author

marcj commented Dec 10, 2013

Ok, got it. Have to define the requirements in the @Rest\Get annotation. Unfortunately, that annotation does not support descriptions or something like that.

@marcj marcj closed this as completed Dec 10, 2013
@marcj
Copy link
Author

marcj commented Dec 10, 2013

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?

@marcj marcj reopened this Dec 10, 2013
@marcj
Copy link
Author

marcj commented Dec 10, 2013

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?

@lsmith77
Copy link
Member

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

@lsmith77 lsmith77 added this to the 2.0 milestone Jul 10, 2015
@lsmith77 lsmith77 modified the milestone: 2.0 Nov 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants