-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Removed calls to Twig\Environment::loadTemplate() #33273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php
Outdated
Show resolved
Hide resolved
@@ -154,7 +154,7 @@ protected function loadResourcesFromTheme($cacheKey, &$theme) | |||
{ | |||
if (!$theme instanceof Template) { | |||
/* @var Template $theme */ | |||
$theme = $this->environment->loadTemplate($theme); | |||
$theme = $this->environment->load($theme)->unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabpot the reason why we need to unwrap here is that we rely on the internal getBlocks
function of the Template class. We don't only want to use the block names, so the non-internal getBlockNames
is not enough for us (we are also relying on the internal displayBlock
signature which has more arguments)
src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php
Outdated
Show resolved
Hide resolved
@stof is right, I read too fast. We should avoid to |
the only place needing to unwrap is the form renderer engine, because it relies on internal Twig APIs to manipulate blocks (which is bad news, as there is no BC guarantee for them) |
2fcb90e
to
b792255
Compare
b792255
to
ea9e375
Compare
src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
Show resolved
Hide resolved
I can't do much about the unwrapping in Status: needs review |
CI failure seems to be an internal hiccup at Travis. |
Thank you @derrabus. |
This PR was merged into the 4.4 branch. Discussion ---------- Removed calls to Twig\Environment::loadTemplate() | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | N/A | License | MIT | Doc PR | N/A This PR prepares #33039. Twig 3 does not have the `loadTemplate()` anymore, so this PR replaces calls to that method. Commits ------- ea9e375 Removed calls to Twig\Environment::loadTemplate().
This PR prepares #33039. Twig 3 does not have the
loadTemplate()
anymore, so this PR replaces calls to that method.