FriendsOfSymfony/FOSRestBundle — pull request #213 by eriksencosta (2012-03-29 02:58:31+00:00)
Title: fixes fatal error when ViewResponseListener::onKernelController does not...

... have a Template configuration for the _view request attribute

This happens because `ViewResponseListener` calls the overriden [Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController()](https://github.com/sensio/SensioFrameworkExtraBundle/blob/master/EventListener/TemplateListener.php) leading to the following fatal error:

Fatal error: Call to undefined method Symfony\Bundle\FrameworkBundle\Templating\TemplateReference::getTemplate() in /vagrant/sf-standard/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/EventListener/TemplateListener.php on line 61

As you can see in `TemplateListener` ([L61](https://github.com/sensio/SensioFrameworkExtraBundle/blob/master/EventListener/TemplateListener.php#L61)) it expects a `Sensio\Bundle\FrameworkExtraBundle\Configuration\Template` instance. The first time though, it sets a `Symfony\Bundle\FrameworkBundle\Templating\TemplateReference` ([L66](https://github.com/sensio/SensioFrameworkExtraBundle/blob/master/EventListener/TemplateListener.php#L66)) leading to the fatal error when called the second time.