|
13 | 13 |
|
14 | 14 | use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
15 | 15 | use Symfony\Component\Config\Loader\LoaderInterface;
|
| 16 | +use Symfony\Component\Config\Resource\FileResource; |
16 | 17 | use Symfony\Component\DependencyInjection\ContainerBuilder;
|
17 | 18 | use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
18 | 19 | use Symfony\Component\Routing\RouteCollectionBuilder;
|
@@ -45,25 +46,22 @@ public function registerBundles()
|
45 | 46 |
|
46 | 47 | protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
|
47 | 48 | {
|
| 49 | + $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); |
48 | 50 | $container->setParameter('container.dumper.inline_class_loader', true);
|
49 | 51 | $confDir = $this->getProjectDir().'/config';
|
50 |
| - $loader->load($confDir.'/packages/*'.self::CONFIG_EXTS, 'glob'); |
51 |
| - if (is_dir($confDir.'/packages/'.$this->environment)) { |
52 |
| - $loader->load($confDir.'/packages/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob'); |
53 |
| - } |
54 |
| - $loader->load($confDir.'/services'.self::CONFIG_EXTS, 'glob'); |
55 |
| - $loader->load($confDir.'/services_'.$this->environment.self::CONFIG_EXTS, 'glob'); |
| 52 | + |
| 53 | + $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob'); |
| 54 | + $loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob'); |
| 55 | + $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob'); |
| 56 | + $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); |
56 | 57 | }
|
57 | 58 |
|
58 | 59 | protected function configureRoutes(RouteCollectionBuilder $routes)
|
59 | 60 | {
|
60 | 61 | $confDir = $this->getProjectDir().'/config';
|
61 |
| - if (is_dir($confDir.'/routes/')) { |
62 |
| - $routes->import($confDir.'/routes/*'.self::CONFIG_EXTS, '/', 'glob'); |
63 |
| - } |
64 |
| - if (is_dir($confDir.'/routes/'.$this->environment)) { |
65 |
| - $routes->import($confDir.'/routes/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); |
66 |
| - } |
67 |
| - $routes->import($confDir.'/routes'.self::CONFIG_EXTS, '/', 'glob'); |
| 62 | + |
| 63 | + $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); |
| 64 | + $routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); |
| 65 | + $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); |
68 | 66 | }
|
69 | 67 | }
|
0 commit comments