sensiolabs/SensioFrameworkExtraBundle — pull request #266 by lemoinem (2014-01-07 17:42:14+00:00)
Title: Specifying templates directly in Routes

This allows using a `_template` attribute in the route directly to specify a template, just as if a `@Template` annotation was used.

Disclaimer: This PR is basically a reimplementation of sensiolabs/SensioFrameworkExtraBundle#253 I tried to reach the initial author of the PR (@ewgRa), but to no avail.

I re-implemented the PR because my solution is much simpler (8 lines) and avoid declaring a new EventSubscriber.
I also took the occasion to write some documentation for it.

This PR contains an additional feature with respect to the original one: If `true` is specified as the value for `_template`, Then the TemplateListener will use the Template auto guessing. I though this might be useful when Routes are generated using PHP or another configuration loader supporting literals.
This allow us to have to insert an additional `use Template` and `@Template` annotation in very simple cases.

Moreover, if an invalid value is specified for `_template`, the listener will simply ignore it (as opposed to crashing before).