-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Config][FrameworkBundle] Add CacheWarmer for ConfigBuilder #40804
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
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Command/BuildDebugContainerTrait.php
Outdated
Show resolved
Hide resolved
$this->dumpExtension($extension, $generator); | ||
} catch (\Throwable $e) { | ||
if ($this->logger) { | ||
$this->logger->warning('Failed to generate ConfigBuilder for extension {extensionClass).', ['exception' => $e, 'extensionClass' => \get_class($extension)]); |
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.
If a (bundle) extension is using some syntax not supported by the generator builder, we dont want an exception when warming the cache. The user may not even be using the ConfigBuilder for that extension.
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.
s/{extensionClass)/{extensionClass}
src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ConfigBuilderCacheWarmer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Command/BuildDebugContainerTrait.php
Outdated
Show resolved
Hide resolved
…ebugContainerTrait::getContainerBuilder() (Nyholm) This PR was squashed before being merged into the 5.3-dev branch. Discussion ---------- [FrameworkBundle] Add argument KernelInterface to BuildDebugContainerTrait::getContainerBuilder() | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | This comes from a suggestion by `@yceruto` #40804 (comment) This change will make the trait usable outside the `Command` namespace. I did not find a better namespace to move the trait to though.. This patch will help #40804 The trait is internal so the change is okey. Commits ------- 0e9652a [FrameworkBundle] Add argument KernelInterface to BuildDebugContainerTrait::getContainerBuilder()
src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ConfigBuilderCacheWarmer.php
Outdated
Show resolved
Hide resolved
56cc9e6
to
c1d6c0e
Compare
Thank you @Nyholm. |
Awesome. :) |
if ($extension instanceof ConfigurationInterface) { | ||
$configuration = $extension; | ||
} elseif ($extension instanceof ConfigurationExtensionInterface) { | ||
$configuration = $extension->getConfiguration([], $this->getContainerBuilder($this->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.
$extension->getConfiguration()
can return null
, while $generator->build()
doesn't accept null
. See doctrine/DoctrineFixturesBundle#349.
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.
Thanks for testing prereleases! This will be fixed by #40859
Make sure ConfigBuilder exists before you write your first line of config.
This is similar to #40803