Skip to content

Commit

Permalink
Рефакторинг
Browse files Browse the repository at this point in the history
  • Loading branch information
ProklUng committed Jul 24, 2021
1 parent bf04840 commit 1da6f2b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->scalarNode('router_request_context_host')->defaultValue('%kernel.site.host%')->end()
->scalarNode('router_request_context_scheme')->defaultValue('http')->end()
->scalarNode('router_request_context_base_url')->defaultValue('')->end()
->scalarNode('router_cache_path')->defaultValue('%kernel.cache_dir%/routes')->end()
->scalarNode('router_caching_routes')->defaultValue(false)->end()
->scalarNode('router_cache_path')->defaultValue(null)->end()
->booleanNode('router_check_exists_controller')->defaultValue(false)->end()
->arrayNode('controller_annotations_path')
->useAttributeAsKey('name')
Expand Down
3 changes: 1 addition & 2 deletions DependencyInjection/SymfonyRouterExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ private function registerRouterConfiguration(
$container->setParameter('router.request.context.scheme', $config['router_request_context_scheme']);
$container->setParameter('router.request.context.base_url', $config['router_request_context_base_url']);
$container->setParameter('router.cache.path', $config['router_cache_path']);
$container->setParameter('router.caching.routes', $config['router_caching_routes']);
$container->setParameter('router.config.file', $config['router_config_file']);
$container->setParameter('controller.annotations.path', $config['controller_annotations_path']);
$container->setParameter('default_uri', $config['default_uri']);
Expand Down Expand Up @@ -161,7 +160,7 @@ private function registerRouterConfiguration(
}

// Применить кэширование роутов, если это задано опцией.
if ($config['router_caching_routes']) {
if ($config['router_cache_path']) {
$routerDefinition = $container->getDefinition('router');
$routerDefinition->addMethodCall(
'setConfigCacheFactory',
Expand Down
4 changes: 2 additions & 2 deletions readme.MD
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

- `enabled` - Использовать бандл. По умолчанию `true`.
- `controller_annotations_path` - массив с путями к контроллерам, использующим аннотации.
- `router_caching_routes` - кэшировать ли роуты. По умолчанию - false.
- `router_cache_path` - путь к кэшу аннотаций. По умолчанию `%kernel.cache_dir%/routes`.
- `router_cache_path` - путь к кэшу аннотаций (вида `%kernel.cache.dir%/routes`). По умолчанию `null`.
Если задан, то роуты будут кэшироваться.
- `router_config_file` - путь к файлу с конфигурацией роутов. По умолчанию `local/configs/routes.yaml`. Файл может быть в любом поддерживаемом Symfony формате - Yaml, PHP, XML и т.д.
- `router_check_exists_controller` - проверять на существование классы-контроллеры. По умолчанию `false`.

0 comments on commit 1da6f2b

Please sign in to comment.