Skip to content

[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

Merged
merged 1 commit into from
Apr 14, 2021

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Apr 13, 2021

Q A
Branch? 5.x
Bug fix? no
New feature? yes
Deprecations?
Tickets
License MIT
Doc PR

Make sure ConfigBuilder exists before you write your first line of config.

This is similar to #40803

$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)]);
Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

s/{extensionClass)/{extensionClass}

@Nyholm Nyholm added the Ready label Apr 14, 2021
OskarStark added a commit that referenced this pull request Apr 14, 2021
…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()
@nicolas-grekas
Copy link
Member

Thank you @Nyholm.

@Nyholm
Copy link
Member Author

Nyholm commented Apr 14, 2021

Awesome. :)

if ($extension instanceof ConfigurationInterface) {
$configuration = $extension;
} elseif ($extension instanceof ConfigurationExtensionInterface) {
$configuration = $extension->getConfiguration([], $this->getContainerBuilder($this->kernel));
Copy link
Contributor

@stephanvierkant stephanvierkant Apr 18, 2021

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.

Copy link
Member

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

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.

7 participants