Skip to content

If pk not in request then use ParamConverter name #190

Closed
wants to merge 6 commits into from

3 participants

@redexp
redexp commented Nov 7, 2012

It's useful when using FOSRestBundle with automatic routing loader and ParamConverter.

    /**
     * @View()
     * @ParamConverter("user", options={"mapping": {"user": "id"}})
     */
    public function getUserAction(Model\User $user)
    {
        return $user;
    }

you know FOSRestBundle will generate for this method route like

/users/{user}

Without that ParamConverter propel can't figure out which parameter is pk
With my changes you don't need to map "user" parameter to "id"

@willdurand
Propel member
@jaugustin
Propel member

I am not in favor of this hack, because it will break everything

this PR totaly by pass the mapping informations and break the use of smart query by column name,

@redexp
redexp commented Nov 8, 2012

Why it will break everything? As for me it's very logical If argument is Propel model then pk for it should be or in parameter which name equals to pk field of this model or in parameter which name is equal to name of this argument

@jaugustin
Propel member

Did you try to run tests?

You always force the query by PK, even if it's not wanted by the user

you could create your own paramConverter to do this but this will not be integrated like this in PropelBundle

redexp added some commits Nov 8, 2012
@redexp redexp closed this Nov 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.