Skip to content

Commit 5b40f0f

Browse files
committed
Доработки
1 parent 4d8e469 commit 5b40f0f

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

DependencyInjection/Configuration.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ public function getConfigTreeBuilder(): TreeBuilder
2929
->scalarNode('router_request_context_base_url')->defaultValue('')->end()
3030
->scalarNode('router_cache_path')->defaultValue('%kernel.cache_dir%/routes')->end()
3131
->scalarNode('router_config_file')->defaultValue('app/routes.yaml')->end()
32+
->arrayNode('controller_annotations_path')
33+
->useAttributeAsKey('name')
34+
->prototype('scalar')->end()
35+
->defaultValue([])
36+
->end()
3237
->scalarNode('http_port')->defaultValue(80)->end()
3338
->scalarNode('https_port')->defaultValue(443)->end()
3439
->scalarNode('resource')->defaultValue('%kernel.project_dir%/app/routes.yaml')->end()

DependencyInjection/WpSymfonyRouterExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ private function registerRouterConfiguration(
108108
$container->setParameter('router.request.context.base_url', $config['router_request_context_base_url']);
109109
$container->setParameter('router.cache.path', $config['router_cache_path']);
110110
$container->setParameter('router.config.file', $config['router_config_file']);
111+
$container->setParameter('controller.annotations.path', $config['controller_annotations_path']);
111112
$container->setParameter('default_uri', $config['default_uri']);
112113

113114
if ($config['utf8']) {

readme.MD

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
2) Подключение бандла в `standalone_bundles.php`
1313

14-
## Всякое
14+
## Параметры
1515

16-
### Файл с роутами
16+
Файл `symfony_router.yaml` в конфигурации бандлов:
1717

18-
Передается через параметр `router_config_file` конфигурации бандла (`symfony_router.yaml` в конфигурации бандлов).
19-
Файл может быть в любом поддерживаемом Symfony формате - Yaml, PHP, XML и т.д.
20-
21-
По умолчанию - `app/routes.yaml`.
18+
- `enabled` - Использовать бандл. По умолчанию `true`.
19+
- `controller_annotations_path` - массив с путями к контроллерам, использующим аннотации.
20+
- `router_cache_path` - путь к кэшу аннотаций. По умолчанию `%kernel.cache_dir%/routes`.
21+
- `router_config_file` - путь к файлу с конфигурацией роутов. По умолчанию `app/routes.yaml`. Файл может быть в любом поддерживаемом Symfony формате - Yaml, PHP, XML и т.д.

0 commit comments

Comments
 (0)