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

Skip to content

[FrameworkBundle] Add router.ignore_cache config option #53059

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ CHANGELOG
* Add `secrets:reveal` command
* Add `rate_limiter` option to `http_client.default_options` and `http_client.scoped_clients`
* Attach the workflow's configuration to the `workflow` tag
* Add `router.ignore_cache` config option
Copy link
Member

Choose a reason for hiding this comment

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

no_cache?


7.0
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,9 @@ private function addRouterSection(ArrayNodeDefinition $rootNode): void
->scalarNode('type')->end()
->scalarNode('cache_dir')
->defaultValue('%kernel.build_dir%')
->setDeprecated('symfony/framework-bundle', '7.1', 'Setting the "%path%.%node%" configuration option is deprecated. It will be removed in version 8.0.')
->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.')
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
->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.')
->setDeprecated('symfony/framework-bundle', '7.1', 'Setting the "%path%.%node%" configuration option is deprecated. It will be removed in version 8.0. Use the "no_cache" option if you want to disable the router cache.')

->end()
->booleanNode('ignore_cache')->defaultFalse()->end()
->scalarNode('default_uri')
->info('The default URI used to generate URLs in a non-HTTP context')
->defaultNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,10 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co

$container->setParameter('router.resource', $config['resource']);
$container->setParameter('router.cache_dir', $config['cache_dir']);
if ($config['ignore_cache']) {
$container->setParameter('router.cache_dir', null);
}

$router = $container->findDefinition('router.default');
$argument = $router->getArgument(2);
$argument['strict_requirements'] = $config['strict_requirements'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
<xsd:attribute name="utf8" type="xsd:boolean" />
<xsd:attribute name="default-uri" type="xsd:string" />
<xsd:attribute name="cache-dir" type="xsd:string" />
<xsd:attribute name="ignore-cache" type="xsd:boolean" />
</xsd:complexType>

<xsd:complexType name="session">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ protected static function getBundleDefaultConfig()
'strict_requirements' => true,
'utf8' => true,
'cache_dir' => '%kernel.build_dir%',
'ignore_cache' => false,
],
'session' => [
'enabled' => false,
Expand Down