| @@ 22-45 (lines=24) @@ | ||
| 19 | * |
|
| 20 | * @since 7/11/14 10:00 PM |
|
| 21 | */ |
|
| 22 | class DynamicRouterPass implements CompilerPassInterface |
|
| 23 | { |
|
| 24 | ||
| 25 | /** |
|
| 26 | * {@inheritdoc} |
|
| 27 | */ |
|
| 28 | public function process(ContainerBuilder $container) |
|
| 29 | { |
|
| 30 | if ($container->getParameter('tadcka_routing.chain_router.enabled')) { |
|
| 31 | if (false === $container->hasDefinition('tadcka_routing.dynamic_router')) { |
|
| 32 | return null; |
|
| 33 | } |
|
| 34 | ||
| 35 | $dynamicRouter = $container->getDefinition('tadcka_routing.dynamic_router'); |
|
| 36 | ||
| 37 | $dynamicRouter->addTag( |
|
| 38 | 'router', |
|
| 39 | array( |
|
| 40 | 'priority' => $container->getParameter('tadcka_routing.dynamic_router.priority') |
|
| 41 | ) |
|
| 42 | ); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||
| @@ 22-45 (lines=24) @@ | ||
| 19 | * |
|
| 20 | * @since 7/11/14 10:00 PM |
|
| 21 | */ |
|
| 22 | class SymfonyRouterPass implements CompilerPassInterface |
|
| 23 | { |
|
| 24 | ||
| 25 | /** |
|
| 26 | * {@inheritdoc} |
|
| 27 | */ |
|
| 28 | public function process(ContainerBuilder $container) |
|
| 29 | { |
|
| 30 | if ($container->getParameter('tadcka_routing.chain_router.enabled')) { |
|
| 31 | if (false === $container->hasDefinition('router.default')) { |
|
| 32 | return null; |
|
| 33 | } |
|
| 34 | ||
| 35 | $symfonyRouter = $container->getDefinition('router.default'); |
|
| 36 | ||
| 37 | $symfonyRouter->addTag( |
|
| 38 | 'router', |
|
| 39 | array( |
|
| 40 | 'priority' => $container->getParameter('tadcka_routing.router.priority') |
|
| 41 | ) |
|
| 42 | ); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||