[symfony-users] Re: Symfony2 returning a JSON object

2011-06-15 Thread alex.pilon
It would be nice to emulate similar functionality to rails in which you can respond_with a collection or an object and the action will detect what Content-Type it should respond with. On May 12, 8:13 am, Christophe COEVOET s...@notk.org wrote: Le 12/05/2011 14:04, Javier Garcia a crit : On

Re: [symfony-users] Re: Symfony2 returning a JSON object

2011-05-12 Thread Christophe COEVOET
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

[symfony-users] Re: Symfony2 returning a JSON object

2011-05-12 Thread Javier Garcia
On May 12, 1:51 pm, Christophe COEVOET s...@notk.org wrote: the render method is not about creating a response. It is about creating a response *with a content set by a template*. Yes, but.. why not implement render() to create responses whose *content could be 'anything' (JSON data for

Re: [symfony-users] Re: Symfony2 returning a JSON object

2011-05-12 Thread Christophe COEVOET
Le 12/05/2011 14:04, Javier Garcia a écrit : On May 12, 1:51 pm, Christophe COEVOETs...@notk.org wrote: the render method is not about creating a response. It is about creating a response *with a content set by a template*. Yes, but.. why not implement render() to create responses whose

[symfony-users] Re: Symfony2 returning a JSON object

2011-04-26 Thread stickaforkinme
Yeah worked that one out after posting on here... although prefered the old renderText method of sfActions in sf 1.x as this was a bit cleaner. :-) Creating a new response object just seems an odd way to do it as surly you already have a response object on the go. On Apr 26, 8:11 am, Fabien

Re: [symfony-users] Re: Symfony2 returning a JSON object

2011-04-26 Thread Tim Nagel
There is no response object 'on the go'. The controller action's responsibility is to create the response. t On Wed, Apr 27, 2011 at 07:59, stickaforkinme sebdang...@gmail.com wrote: Yeah worked that one out after posting on here... although prefered the old renderText method of sfActions in