-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[TwigBundle] fixed usage when Templating is not installed #21205
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
@@ -10,8 +10,6 @@ | |||
<tag name="twig.loader"/> | |||
</service> | |||
|
|||
<service id="twig.loader" alias="twig.loader.filesystem" /> |
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.
Not needed as handled by the loader pass.
70f172b
to
8a49a0b
Compare
$loader->addTag('twig.loader'); | ||
$loader->setMethodCalls($container->getDefinition('twig.loader.filesystem')->getMethodCalls()); | ||
$twigLoader = $container->getDefinition('twig.loader.native_filesystem'); | ||
if ($container->has('templating')) { |
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.
Why not checking for twig.loader.filesystem
here?
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.
indeed, done
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.
reverted
14d6eab
to
8553d79
Compare
Looks like we need to add some more checks to make sure that the Templating component is not only present, but that the |
8553d79
to
6aa98d1
Compare
That's why checking on 'templating' was better. Switched back, tests pass now. |
Indeed, that's better. |
…(fabpot) This PR was merged into the 2.7 branch. Discussion ---------- [TwigBundle] fixed usage when Templating is not installed | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | bug introduced in #20799 | License | MIT | Doc PR | n/a In #20799, the decoupling of the Templating definition means that the `twig.loader.filesystem` is not always defined, but used in Extension. So, this PR does the opposite as what was done before. Use `twig.loader.native_filesystem` by default and copy paths to `twig.loader.filesystem` when templating is used. /cc @xabbuh Commits ------- 6aa98d1 [TwigBundle] fixed usage when Templating is not installed
@fabpot what about registering a loader resolving only the |
@stof Might be an idea, but it's done this way for performance optimization: it avoids having the chain loader. |
In #20799, the decoupling of the Templating definition means that the
twig.loader.filesystem
is not always defined, but used in Extension. So, this PR does the opposite as what was done before. Usetwig.loader.native_filesystem
by default and copy paths totwig.loader.filesystem
when templating is used./cc @xabbuh