symfony2 render controller with get parameters symfony2 render controller with get parameters symfony symfony

symfony2 render controller with get parameters


In accordion with the doc the query argument is the third parameters.

{{ controller(controller, attributes, query) }}

So try this:

{{ render(controller('AutoBundle:MyController:main', {}, { 'id': id, 'active': true } )) }}

Hope this help


Yes, it doesn't send the parameters as a GET request, but seems to call the method directly.

Twig template part:

<div id="question-choose-semester">    {{ render(controller('UnswCamsBundle:Semester:choiceAjax', { 'redirect':  path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params'))} )) }}</div>

Create an optional parameter. If using annotations to define the route, you don't have to add it to the annotation specification.

  public function choiceAjaxAction($redirect = "", Request $request) {

Then check the GET parameter:

if (empty($redirect)) {  $redirect_uri = $request->query->get('Redirect');} else {