Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Unable to pass objects to {{ render }} when embedding a controller anymore #6822

Closed
@nail

Description

@nail

Hello,

I'm not sure if this is a regression or if this is on purpose due to the changes made to fix CVE-2012-6432, but we can't seem to be able to pass objects to subrequests anymore, only scalars, after having updated to the latest sf 2.2.

For example, what used to be:

{% render "SomeBundle:Foo:Bar" with {'someObject': someObject} %}

Should now become:

{{ render(controller("SomeBundle:Foo:Bar", {'someObject': someObject}) }}

However if someObject is an instance of SomeObject, this will throw an exception saying that the action "...requires that you provide a value for the "$someObject" argument...". The action signature being public function widgetAction($someObject). When adding typehinting (widgetAction(SomeObject $someObject)), an "Unable to guess how to get a Doctrine instance from the request information." error is thrown (adding a ParamConverter doesn't help)

The ability to pass objects was quite handy, especially to avoid reloading entities based on their ids in re-usable widgets/partials. Has this feature been removed deliberately? (or maybe am I doing something wrong?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions