|
18 | 18 | use Symfony\Component\HttpFoundation\Session\SessionFactoryInterface; |
19 | 19 | use Symfony\Component\HttpKernel\Bundle\BundleInterface; |
20 | 20 | use Symfony\Component\HttpKernel\Kernel as BaseKernel; |
| 21 | +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; |
21 | 22 | use Symfony\Component\Routing\RouteCollectionBuilder; |
22 | 23 |
|
23 | 24 | use function dirname; |
@@ -68,12 +69,21 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa |
68 | 69 | } |
69 | 70 | } |
70 | 71 |
|
71 | | - protected function configureRoutes(RouteCollectionBuilder $routes): void |
| 72 | + /** |
| 73 | + * @param RoutingConfigurator|RouteCollectionBuilder $routes |
| 74 | + */ |
| 75 | + protected function configureRoutes($routes): void |
72 | 76 | { |
73 | 77 | $confDir = $this->getProjectDir() . '/config'; |
74 | 78 |
|
75 | | - $routes->import($confDir . '/{routes}/' . $this->environment . '/*' . self::CONFIG_EXTS, '/', 'glob'); |
76 | | - $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob'); |
77 | | - $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob'); |
| 79 | + if (true === $routes instanceof RoutingConfigurator) { |
| 80 | + $routes->import($confDir . '/{routes}/' . $this->environment . '/*' . self::CONFIG_EXTS, 'glob'); |
| 81 | + $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, 'glob'); |
| 82 | + $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, 'glob'); |
| 83 | + } elseif (true === $routes instanceof RouteCollectionBuilder) { |
| 84 | + $routes->import($confDir . '/{routes}/' . $this->environment . '/*' . self::CONFIG_EXTS, '/', 'glob'); |
| 85 | + $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob'); |
| 86 | + $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob'); |
| 87 | + } |
78 | 88 | } |
79 | 89 | } |
0 commit comments