-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] forward-compatibility with HttpKernel 5 #33356
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
xabbuh
commented
Aug 27, 2019
Q | A |
---|---|
Branch? | 4.4 |
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | |
License | MIT |
Doc PR |
src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinder.php
Outdated
Show resolved
Hide resolved
9f3a869
to
a50c999
Compare
@@ -32,7 +32,6 @@ | |||
<service id="templating.finder" class="Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinder"> | |||
<argument type="service" id="kernel" /> | |||
<argument type="service" id="templating.filename_parser" /> | |||
<argument>%kernel.root_dir%/Resources</argument> |
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.
Is there another way to get this path for TemplateFinder
? otherwise it's a BC break to me (solved by #33356 (comment))
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 sure what we can do here. The parameter will be gone with HttpKernel 5 and the class will be dropped in FrameworkBundle 5 too. I don't see what would be the fallback value here. The only safe solution probably would be to not allow HttpKernel 5.
@@ -60,7 +60,9 @@ public function findAllTemplates() | |||
$templates = array_merge($templates, $this->findTemplatesInBundle($bundle)); | |||
} | |||
|
|||
$templates = array_merge($templates, $this->findTemplatesInFolder($this->rootDir.'/views')); | |||
if (null !== $this->rootDir) { |
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.
shouldn't we use $this->kernel->getContainer()->hasParameter('kernel.root_dir')
here as well?
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.
We don't have the container here. We inject the argument depending on the presence of the parameter.
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 we have the kernel instance, no? $this->kernel->getContainer()
?
@@ -41,7 +41,7 @@ | |||
|
|||
<service id="twig.template_iterator" class="Symfony\Bundle\TwigBundle\TemplateIterator"> | |||
<argument type="service" id="kernel" /> | |||
<argument>%kernel.root_dir%</argument> | |||
<argument /> |
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.
Same here, we should update TemplateIterator
to get this path from $this->kernel->getContainer()
to keep BC.
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.
and this argument needs to be deprecated to get rid of it in 5.0.
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 don't see how this would solve the BC break. If the parameter isn't present, asking the kernel for the parameter doesn't solve that.
LGTM. But I think it would be easier and with less side-effects to simply not allow HttpKernel 5 in FrameworkBundle 4. |
That would be fine for me too. |
a50c999
to
7131d9e
Compare
@@ -132,11 +132,10 @@ protected function execute(InputInterface $input, OutputInterface $output) | |||
$domain = $input->getOption('domain'); | |||
/** @var KernelInterface $kernel */ | |||
$kernel = $this->getApplication()->getKernel(); | |||
$rootDir = $kernel->getContainer()->getParameter('kernel.root_dir'); |
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.
$rootDir = $kernel->getContainer()->hasParameter('kernel.root_dir') ? $kernel->getContainer()->getParameter('kernel.root_dir') : null
then compare to null
below?
let's forbid HttpKernel 5 instead (see #33390) |
… (xabbuh) This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle][TwigBundle] conflict with HttpKernel 5 | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | replaces #33356 | License | MIT | Doc PR | Commits ------- 7d94b7c conflict with HttpKernel 5