bug #44998 [FrameworkBundle] Allow default cache pools to be overwritten by user (Seldaek)
This PR was merged into the 5.3 branch.
Discussion
----------
[FrameworkBundle] Allow default cache pools to be overwritten by user
| Q | A
| ------------- | ---
| Branch? | 5.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fixes https://github.com/symfony/symfony/issues/44984
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
<!--
Replace this notice by a short README for your feature/bugfix.
This will help reviewers and should be a good start for the documentation.
Additionally (see https://symfony.com/releases):
- Always add tests and ensure they pass.
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too.)
- Features and deprecations must be submitted against the latest branch.
- Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
- Never break backward compatibility (see https://symfony.com/bc).
-->
Commits
-------
cc7cf5a4a6
[FrameworkBundle] Allow default cache pools to be overwritten by user
This commit is contained in:
commit
01640e874a
|
@ -307,30 +307,10 @@ class FrameworkExtension extends Extension
|
|||
}
|
||||
}
|
||||
|
||||
// register cache before session so both can share the connection services
|
||||
$this->registerCacheConfiguration($config['cache'], $container);
|
||||
|
||||
if ($this->isConfigEnabled($container, $config['session'])) {
|
||||
if (!\extension_loaded('session')) {
|
||||
throw new LogicException('Session support cannot be enabled as the session extension is not installed. See https://php.net/session.installation for instructions.');
|
||||
}
|
||||
|
||||
$this->sessionConfigEnabled = true;
|
||||
$this->registerSessionConfiguration($config['session'], $container, $loader);
|
||||
if (!empty($config['test'])) {
|
||||
$container->getDefinition('test.session.listener')->setArgument(1, '%session.storage.options%');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->isConfigEnabled($container, $config['request'])) {
|
||||
$this->registerRequestConfiguration($config['request'], $container, $loader);
|
||||
}
|
||||
|
||||
if (null === $config['csrf_protection']['enabled']) {
|
||||
$config['csrf_protection']['enabled'] = $this->sessionConfigEnabled && !class_exists(FullStack::class) && ContainerBuilder::willBeAvailable('symfony/security-csrf', CsrfTokenManagerInterface::class, ['symfony/framework-bundle']);
|
||||
}
|
||||
$this->registerSecurityCsrfConfiguration($config['csrf_protection'], $container, $loader);
|
||||
|
||||
if ($this->isConfigEnabled($container, $config['form'])) {
|
||||
if (!class_exists(Form::class)) {
|
||||
throw new LogicException('Form support cannot be enabled as the Form component is not installed. Try running "composer require symfony/form".');
|
||||
|
@ -459,6 +439,28 @@ class FrameworkExtension extends Extension
|
|||
$this->registerUidConfiguration($config['uid'], $container, $loader);
|
||||
}
|
||||
|
||||
// register cache & dependencies last so that user-defined cache pools take precedence over the default pools created above (e.g. in rate_limiter, validation)
|
||||
$this->registerCacheConfiguration($config['cache'], $container);
|
||||
|
||||
// register session after cache so both can share the connection services
|
||||
if ($this->isConfigEnabled($container, $config['session'])) {
|
||||
if (!\extension_loaded('session')) {
|
||||
throw new LogicException('Session support cannot be enabled as the session extension is not installed. See https://php.net/session.installation for instructions.');
|
||||
}
|
||||
|
||||
$this->sessionConfigEnabled = true;
|
||||
$this->registerSessionConfiguration($config['session'], $container, $loader);
|
||||
if (!empty($config['test'])) {
|
||||
$container->getDefinition('test.session.listener')->setArgument(1, '%session.storage.options%');
|
||||
}
|
||||
}
|
||||
|
||||
// csrf depends on session being registered
|
||||
if (null === $config['csrf_protection']['enabled']) {
|
||||
$config['csrf_protection']['enabled'] = $this->sessionConfigEnabled && !class_exists(FullStack::class) && ContainerBuilder::willBeAvailable('symfony/security-csrf', CsrfTokenManagerInterface::class, ['symfony/framework-bundle']);
|
||||
}
|
||||
$this->registerSecurityCsrfConfiguration($config['csrf_protection'], $container, $loader);
|
||||
|
||||
$this->addAnnotatedClassesToCompile([
|
||||
'**\\Controller\\',
|
||||
'**\\Entity\\',
|
||||
|
|
Reference in New Issue