Symfony2: in Twig, pass Request with Render function

前端 未结 3 942
感情败类
感情败类 2020-12-17 15:27

I understand that using {% render() %} automatically forces a new request object to be sent, but im curious if theres a way to pass in the originating request a

3条回答
  •  没有蜡笔的小新
    2020-12-17 16:01

    use the render function as a result

    {{ render(controller('MyBundle:ControllerName:example', {'originalRequest': app.request})) }}
    

    and then in your controller

    public function exampleAction(Request $originalRequest)
    {
        // do something
    }
    

提交回复
热议问题