Skip to content

Commit 88a7ef4

Browse files
committed
[FrameworkBundle] Add router.ignore_cache config option
Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>
1 parent 4328f5b commit 88a7ef4

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CHANGELOG
99
* Move the Router `cache_dir` to `kernel.build_dir`
1010
* Deprecate the `router.cache_dir` config option
1111
* Add `rate_limiter` tags to rate limiter services
12+
* Add `router.ignore_cache` config option
1213

1314
7.0
1415
---

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,9 @@ private function addRouterSection(ArrayNodeDefinition $rootNode): void
621621
->scalarNode('type')->end()
622622
->scalarNode('cache_dir')
623623
->defaultValue('%kernel.build_dir%')
624-
->setDeprecated('symfony/framework-bundle', '7.1', 'Setting the "%path%.%node%" configuration option is deprecated. It will be removed in version 8.0.')
624+
->setDeprecated('symfony/framework-bundle', '7.1', 'Setting the "%path%.%node%" configuration option is deprecated. It will be removed in version 8.0. Please use the "ignore_cache" option if you want to ignore the cache in the router.')
625625
->end()
626+
->booleanNode('ignore_cache')->defaultFalse()->end()
626627
->scalarNode('default_uri')
627628
->info('The default URI used to generate URLs in a non-HTTP context')
628629
->defaultNull()

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

+4
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,10 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co
11941194

11951195
$container->setParameter('router.resource', $config['resource']);
11961196
$container->setParameter('router.cache_dir', $config['cache_dir']);
1197+
if ($config['ignore_cache']) {
1198+
$container->setParameter('router.cache_dir', null);
1199+
}
1200+
11971201
$router = $container->findDefinition('router.default');
11981202
$argument = $router->getArgument(2);
11991203
$argument['strict_requirements'] = $config['strict_requirements'];

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
<xsd:attribute name="utf8" type="xsd:boolean" />
120120
<xsd:attribute name="default-uri" type="xsd:string" />
121121
<xsd:attribute name="cache-dir" type="xsd:string" />
122+
<xsd:attribute name="ignore-cache" type="xsd:boolean" />
122123
</xsd:complexType>
123124

124125
<xsd:complexType name="session">

0 commit comments

Comments
 (0)