Skip to content

[2.2] ParamConverters in FrameworkBundle #1547

@beberlei

Description

@beberlei

We should look at ways to move param converters to the framework bundle again. Instead of defining the converters on a per variable basis as in extra bundle @ParamConverter the converters should be registered globally and be matched on the hinted class, ordered by priority of the converters registered:

Say:

public function fooAction(Post $post) { }

Then FrameworkBundle would look if it has one or many parameter converters registered for "Post".

If it has registered converters then based on a priority each parameter converter tries to convert the variable based on the data in the current request. It returns true if it could convert it, false if it couldnt. If no converting mechanism could be found for a class through all the current request data then it should throw an exception.

This would allow to remove tons of glue code with 404 and security handling and such from the controllers, into the param converters making it much more reusable accross different controllers.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions