Skip to content

[FrameworkBundle] Add configureContainer(), configureRoutes() and getConfigDir() to MicroKernelTrait #42991

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

Merged
merged 1 commit into from
Sep 16, 2021

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 5.4
Bug fix? no
New feature? yes
Deprecations? no
Tickets -
License MIT
Doc PR -

This PR aims at moving code from the Kernel's recipe to MicroKernelTrait.

It has also the benefit of not requiring ppl that don't use the router to still implement configureRoutes() in their app.

@@ -152,7 +185,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)
};

try {
$this->configureContainer(new ContainerConfigurator($container, $kernelLoader, $instanceof, $file, $file, $this->getEnvironment()), $loader);
$configureContainer->getClosure($this)(new ContainerConfigurator($container, $kernelLoader, $instanceof, $file, $file, $this->getEnvironment()), $loader, $container);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3rd argument to help with #35554

@lyrixx
Copy link
Member

lyrixx commented Sep 13, 2021

I like it 👍🏼

@Nyholm
Copy link
Member

Nyholm commented Sep 14, 2021

Please give me another day or two to test and review this carefully.

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Thank you

@amberovsky
Copy link

@nicolas-grekas why configureContainer and configureRoutes are private? They are mentioned as protected in the latest documentation https://symfony.com/doc/current/configuration/micro_kernel_trait.html
It was useful to be able to override them, how it is suggested to change the way configuration/routes are loaded now?

@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Feb 7, 2022

Method from traits can be overridden in the class that uses the trait even if they are private.
If you need to override them from a class child, you can make the methods protected when importing the trait, see eg
https://www.php.net/manual/en/language.oop5.traits.php#language.oop5.traits.visibility

@amberovsky
Copy link

🤦 thank you @nicolas-grekas

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