This repository has been archived by the owner on Feb 24, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 #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.
If specified through the route, the
_template
parameter will be removed from_route_params
.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 avoid having 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).