Skip to content

[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

Closed
wants to merge 1 commit into from

Conversation

xabbuh
Copy link
Member

@xabbuh 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

@xabbuh xabbuh force-pushed the framework-bundle-master-compat branch 3 times, most recently from 9f3a869 to a50c999 Compare August 27, 2019 12:30
@@ -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>
Copy link
Member

@yceruto yceruto Aug 27, 2019

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))

Copy link
Member Author

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) {
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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 />
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

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.

@Tobion
Copy link
Contributor

Tobion commented Aug 27, 2019

LGTM. But I think it would be easier and with less side-effects to simply not allow HttpKernel 5 in FrameworkBundle 4.

@xabbuh
Copy link
Member Author

xabbuh commented Aug 27, 2019

That would be fine for me too.

@xabbuh xabbuh force-pushed the framework-bundle-master-compat branch from a50c999 to 7131d9e Compare August 29, 2019 10:06
@@ -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');
Copy link
Member

@nicolas-grekas nicolas-grekas Aug 29, 2019

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?

@xabbuh
Copy link
Member Author

xabbuh commented Aug 30, 2019

let's forbid HttpKernel 5 instead (see #33390)

@xabbuh xabbuh closed this Aug 30, 2019
@xabbuh xabbuh deleted the framework-bundle-master-compat branch August 30, 2019 11:28
nicolas-grekas added a commit that referenced this pull request Aug 30, 2019
… (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
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants