title: Symfony2 template configuration from routing.yml
body: <p>When dealing with the Sylius e-commerce bundles I have found what seems to be a way of configurig the template for a route, that I didn't know:</p>
  
  <p>I have tested in a fresh Symfony RC 2.2.0 with vendors installation.
  This would be in the routing.yml</p>
  
  <pre><code>_welcome:
      pattern:  /
      defaults:
        _controller: AcmeDemoBundle:Welcome:index
        _template: AcmeDemoBundle:Welcome:index # added by me
  </code></pre>
  
  <p>this generates an error:</p>
  
  <blockquote>
    <p>FatalErrorException: Error: Call to a member function getTemplate() on
    a non-object in
    .... \vendor\sensio\framework-extra-bundle\Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener.php
    line 62</p>
  </blockquote>
  
  <p>now, in TemplateListener, what we have is:</p>
  
  <pre><code>    if (!$configuration = $request-&gt;attributes-&gt;get('_template')) {
          return;
      }
  
  
      if (!$configuration-&gt;getTemplate()) {
          $guesser = $this-&gt;container-&gt;get('sensio_framework_extra.view.guesser');
          $configuration-&gt;setTemplate($guesser-&gt;guessTemplateName($controller, $request, $configuration-&gt;getEngine()));
      }
  </code></pre>
  
  <p>$configuration is a String, actually the template I put in routing.yml (AcmeDemoBundle:Welcome:index). Checked by adding a <code>var_dump</code> and also inspecting ParameterBag -> get method which is what <code>$request-&gt;attributes</code> is.</p>
  
  <p>So. Why TemplateListener is expecting an object? What am I missing? Am I missconfiguring in routing.yml?</p>