1
votes

I use the twig render function to render a controller :

 {% render(controller("MyAppDemoBundle:Default:footer")) %}

It seems that the rendered controller didn't receive the request as the main controller. So the request method is always set to "GET", even if the main request is POST.

Is it normal ?

2

2 Answers

2
votes

You can forward the request like this:

{% render(controller("MyAppDemoBundle:Default:footer", {request: app.request})) %}

Remember that you need to pass the request as a variable of your controller action in order for this to work.

1
votes

Yes, this is completely normal. The render function from twig initiates another request which is completely independent from the main request. So you will also not be able to access any post or get variables in this sub-request.