2013-05-11 3 views
2

모든 경로에서 설정 요구 사항 키 {_locale}에 대한 라우팅 로더 (routing.loader)를 무시하고 기본값으로 설정하면이 키가 기본값으로 설정됩니다. 모든 로케일은 데이터베이스에 저장됩니다. 그리고 DB에서 요구 사항 매개 변수를로드하기 때문에 데이터베이스에 새로운 로케일을 저장 한 후 명확한 라우팅 캐시 (Matcher 및 Dumper 캐시 클래스)를 원합니다.Symfony 2의 라우팅 캐시의 투명성

감사합니다.

답변

5

심포니 캐시 경로 파일 :

appDevUrlMatcher.php appDevUrlGenerator.php

캐시 디렉토리, VAR/캐시/dev에있는

(자극)

그냥 삭제이 파일

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); 
} 

그것은 나를 위해 작동합니다.