Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7d538db

Browse files
committed
[FrameworkBundle] Add router.ignore_cache config option
Signed-off-by: Quentin Devos <[email protected]>
1 parent b5ee977 commit 7d538db

File tree

5 files changed

+9
-1
lines changed

5 files changed

+9
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ CHANGELOG
1313
* Add `secrets:reveal` command
1414
* Add `rate_limiter` option to `http_client.default_options` and `http_client.scoped_clients`
1515
* Attach the workflow's configuration to the `workflow` tag
16+
* Add `router.ignore_cache` config option
1617

1718
7.0
1819
---

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,9 @@ private function addRouterSection(ArrayNodeDefinition $rootNode): void
619619
->scalarNode('type')->end()
620620
->scalarNode('cache_dir')
621621
->defaultValue('%kernel.build_dir%')
622-
->setDeprecated('symfony/framework-bundle', '7.1', 'Setting the "%path%.%node%" configuration option is deprecated. It will be removed in version 8.0.')
622+
->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.')
623623
->end()
624+
->booleanNode('ignore_cache')->defaultFalse()->end()
624625
->scalarNode('default_uri')
625626
->info('The default URI used to generate URLs in a non-HTTP context')
626627
->defaultNull()

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,10 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co
11811181

11821182
$container->setParameter('router.resource', $config['resource']);
11831183
$container->setParameter('router.cache_dir', $config['cache_dir']);
1184+
if ($config['ignore_cache']) {
1185+
$container->setParameter('router.cache_dir', null);
1186+
}
1187+
11841188
$router = $container->findDefinition('router.default');
11851189
$argument = $router->getArgument(2);
11861190
$argument['strict_requirements'] = $config['strict_requirements'];

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
<xsd:attribute name="utf8" type="xsd:boolean" />
121121
<xsd:attribute name="default-uri" type="xsd:string" />
122122
<xsd:attribute name="cache-dir" type="xsd:string" />
123+
<xsd:attribute name="ignore-cache" type="xsd:boolean" />
123124
</xsd:complexType>
124125

125126
<xsd:complexType name="session">

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ protected static function getBundleDefaultConfig()
715715
'strict_requirements' => true,
716716
'utf8' => true,
717717
'cache_dir' => '%kernel.build_dir%',
718+
'ignore_cache' => false,
718719
],
719720
'session' => [
720721
'enabled' => false,

0 commit comments

Comments
 (0)