1 | <?php |
||
14 | class Kernel extends BaseKernel |
||
15 | { |
||
16 | use MicroKernelTrait; |
||
17 | private const CONFIG_EXTS = '.{php,xml,yaml,yml}'; |
||
18 | |||
19 | public function registerBundles(): iterable |
||
28 | |||
29 | public function getProjectDir(): string |
||
33 | |||
34 | protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void |
||
35 | { |
||
36 | $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); |
||
37 | $container->setParameter( |
||
38 | 'container.dumper.inline_class_loader', |
||
39 | PHP_VERSION_ID < 70400 || !ini_get('opcache.preload') |
||
40 | ); |
||
41 | $container->setParameter('container.dumper.inline_factories', true); |
||
42 | $confDir = $this->getProjectDir().'/config'; |
||
43 | |||
44 | $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob'); |
||
45 | $loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob'); |
||
46 | $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob'); |
||
47 | $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); |
||
48 | } |
||
49 | |||
50 | protected function configureRoutes(RouteCollectionBuilder $routes): void |
||
51 | { |
||
52 | $confDir = $this->getProjectDir().'/config'; |
||
53 | |||
54 | $routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob'); |
||
55 | $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); |
||
56 | $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); |
||
57 | } |
||
58 | } |
||
59 |