-
Notifications
You must be signed in to change notification settings - Fork 31
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
Apply Symfony best practices #126
Conversation
237c856
to
cc2f0d7
Compare
ping @lolautruche |
* @param \eZ\Bundle\EzPublishLegacyBundle\SetupWizard\ConfigurationDumper $configDumper | ||
* @param \eZ\Bundle\EzPublishLegacyBundle\SetupWizard\ConfigurationConverter $configConverter | ||
* @param \Symfony\Component\HttpFoundation\RequestStack $requestStack | ||
* @param \Symfony\Component\HttpKernel\KernelInterface |
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.
Missed var name in this line?
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 whole PHPDoc could be removed
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.
Yep, thanks. Will fix it tomorrow, when I'm at my laptop :)
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.
A BC note should be added somewhere as some of those changes could be considered as BC breaks (e.g. class parameters if one were relying on that to override)
* @param \eZ\Bundle\EzPublishLegacyBundle\SetupWizard\ConfigurationDumper $configDumper | ||
* @param \eZ\Bundle\EzPublishLegacyBundle\SetupWizard\ConfigurationConverter $configConverter | ||
* @param \Symfony\Component\HttpFoundation\RequestStack $requestStack | ||
* @param \Symfony\Component\HttpKernel\KernelInterface |
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 whole PHPDoc could be removed
@@ -5,7 +5,7 @@ parameters: | |||
ezpublish_legacy.default.module_default_layout: ~ | |||
|
|||
# Pagelayout to use while rendering a content view in legacy | |||
ezpublish_legacy.default.view_default_layout: EzPublishLegacyBundle::legacy_view_default_pagelayout.html.twig | |||
ezpublish_legacy.default.view_default_layout: "@@EzPublishLegacy/legacy_view_default_pagelayout.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.
Why a double @
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.
Without it, Symfony crashes with unknown service error or something similar. I can't find the doc about it ATM, but I have it working like this on some of our other projects, after I've read it in the docs 🙊
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.
Ha, found it!
http://symfony.com/doc/current/service_container/parameters.html
If you use a string that starts with @ or has % anywhere in it, you need to escape it by adding another
@
or%
# config/services.yaml
parameters:
# This will be parsed as string '@securepass'
mailer_password: '@@securepass'
# Parsed as http://symfony.com/?foo=%s&bar=%d
url_pattern: 'http://symfony.com/?foo=%%s&bar=%%d'
@lolautruche I'll write up some 2.0 upgrade docs, thanks 👍 |
Note to self: Need to rebase on master to get the tests running once #122 is merged. |
merged |
371d616
to
6b9323a
Compare
mvc/Kernel/Loader.php
Outdated
@@ -263,7 +264,7 @@ public function setCLIHandler(ezpKernelHandler $kernelHandler) | |||
public function buildLegacyKernelHandlerTreeMenu() | |||
{ | |||
return $this->buildLegacyKernelHandlerWeb( | |||
$this->container->getParameter('ezpublish_legacy.kernel_handler.treemenu.class'), | |||
ezpKernelWeb::class, |
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 it be ezpKernelTreeMenu?
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.
Eeeek, you're right!!
Fixed, thanks!
6b9323a
to
a212141
Compare
@andrerom @crevillo @blankse @lolautruche Ready for final review and merge :) Will writeup upgrade docs in a separate PR. |
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.
LGTM
Thanks everyone! |
calls: | ||
- [setLegacyHelper, ["@ezpublish_legacy.templating.legacy_helper"]] | ||
|
||
# Overriding core helper | ||
ezpublish.templating.global_helper: | ||
alias: ezpublish.templating.global_helper.legacy | ||
public: false |
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 EzPublishCoreBundle\Controller deprecated? The breaks it's 'getGlobalHelper' as it needs the service to be public or an exception is thrown and it is private now.
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.
My guess: helper should be adapted to inject the service(s) instead of relying on contianer.
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 believe when aliasing a service we should change its viability either which is causing me the issue I see.
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.
That could be as well.
@emodric as you're the author of this change, any opinions on the matter :)
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'm fine with it being public, no problem :)
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.
Another approach would be to use the service locator feature in EzPublishCoreBundle\Controller
(Symfony 3.3+)
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.
See implementation in Symfony AbstractController
: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php
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.
Hi guys, I've found this issue after upgrading from an old 5.4 to the new 2.5.6, solved by overriding service definition on my own services.yml file.
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.
Someone willing to do PR to drop this? I agree we should not change this from kernel.
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.
PR: #175
kernel.project_dir
instead ofkernel.root_dir