Le 12/05/2011 13:34, Javier Garcia a écrit :
Since for rendering templates you have to use this:

return $this->render('FooBarBundle:Default:index.html.twig');

wouldn't be more "natural" implementing something like: 
$this->render(json_encode($data), 'json'); ???
The second argument would set the content-type, to avoid to use
$response->headers->set('Content-Type', 'application/json');
the render method is not about creating a response. It is about creating a response *with a content set by a template*.
If you look at the implementation, it is a call to the templating engine.

And if you set the _format variable properly in your routing, you don't need to set the content-type manually as it is still done by the framework based on it.

--
Christophe | Stof

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to