I override routing loader (routing.loader) for set requirements key {_locale} in all my paths and set defaults this key. All locales saved in database. And i want clear routing cache (Matcher and Dumper cache class) after save new locale in database, because requirements parameter load from DB.
Thank.
Symfony cached route files:
appDevUrlMatcher.php appDevUrlGenerator.php
in your cache dir, var/cache/dev(prod)
just delete these files
protected function warmUpRouteCache() {
$router = $this->get('router');
$filesystem = $this->get('filesystem');
$kernel = $this->get('kernel');
$cacheDir = $kernel->getCacheDir();
foreach (array('matcher_cache_class', 'generator_cache_class') as $option) {
$className = $router->getOption($option);
$cacheFile = $cacheDir . DIRECTORY_SEPARATOR . $className . '.php';
$filesystem->remove($cacheFile);
}
$router->warmUp($cacheDir);
}
it works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With