-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[TwigBundle] added a Twig templates warmer when templating is disabled #16271
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
5699644
to
f9ccf12
Compare
private $twig; | ||
private $iterator; | ||
|
||
public function __construct(Twig_Environment \$twig, \Iterator $iterator) |
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.
\Twig_Environment $twig
f9ccf12
to
a3363dc
Compare
private $twig; | ||
private $iterator; | ||
|
||
public function __construct(\Twig_Environment $twig, \Iterator $iterator) |
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.
Passing \Iterator $iterator
looks wrong, it should be \Traversable
?
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.
true, it's currently broken anyway: it passed an InteratorAggregate but expects an Iterator
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.
fixed
a3363dc
to
5cb63cf
Compare
Should be ok now. |
👍 |
'@Bar/index.html.twig', | ||
'@Foo/index.html.twig', | ||
'layout.html.twig', | ||
'sub/sub.html.twig', |
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.
on windows fails, I think DIRECTORY_SEPARATOR
fixed it
'sub'.DIRECTORY_SEPARATOR.'sub.html.twig',
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.
fixed
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.
I've normalized the output of the generator instead.
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.
I think the normalization is not the best way. Twig internally doesn't normalize either.
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.
but Twig uses what the developer uses as name, which may not be the DIRECTORY_SEPARATOR (it is even likely it is not, because you don't have access to this constant easily when including a template)
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.
no, when twig resolves namespaces, it uses the local filesystem separators in its final path
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.
@Tobion this iterator is meant to return template names, not cache keys. So it is the input of the Twig resolution, not the output.
5cb63cf
to
bd3701b
Compare
👍 status: reviewed |
👍 even with the templating component enabled, templates accessed using the Twig native notation were not warmed up btw. |
…ting is disabled (fabpot) This PR was merged into the 2.8 branch. Discussion ---------- [TwigBundle] added a Twig templates warmer when templating is disabled | Q | A | ------------- | --- | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a When disabling the templating component, Twig templates are not warmed up as the warmer depends on the template finder which needs the templating component. This PR adds a new cache warmer that covers this case. see #16262 Commits ------- bd3701b [TwigBundle] added a Twig templates warmer when templating is disabled
@stof Any idea how to fix this? |
…rmer introduced in 2.8 (tucksaun) This PR was merged into the 2.8 branch. Discussion ---------- [TwigBundle] Adjust CacheWarmingTest for TemplateCacheWarmer introduced in 2.8 | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - With #20103, issue reported in #20065 is fixed, however it will now break in 2.8+ as another cache warmer has been introduced with #16271. Commits ------- 360ca48 [TwigBundle] Adjust CacheWarmingTest for TemplateCacheWarmer introduced in 2.8
When disabling the templating component, Twig templates are not warmed up as the warmer depends on the template finder which needs the templating component. This PR adds a new cache warmer that covers this case.
see #16262