]> Raphaƫl G. Git Repositories - airlibre/blob - src/Kernel.php
Add AGPL license
[airlibre] / src / Kernel.php
1 <?php
2
3 namespace App;
4
5 use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
6 use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
7 use Symfony\Component\HttpKernel\Kernel as BaseKernel;
8 use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
9
10 class Kernel extends BaseKernel
11 {
12 use MicroKernelTrait;
13
14 protected function configureContainer(ContainerConfigurator $container): void
15 {
16 $projectDir = $this->getProjectDir();
17
18 $container->import($projectDir.'/config/{packages}/*.yaml');
19 $container->import($projectDir.'/config/{packages}/'.$this->environment.'/*.yaml');
20
21 if (is_file($projectDir.'/config/services.yaml')) {
22 $container->import($projectDir.'/config/services.yaml');
23 $container->import($projectDir.'/config/{services}_'.$this->environment.'.yaml');
24 } else {
25 $container->import($projectDir.'/config/{services}.php');
26 }
27 }
28
29 protected function configureRoutes(RoutingConfigurator $routes): void
30 {
31 $projectDir = $this->getProjectDir();
32
33 $routes->import($projectDir.'/config/{routes}/'.$this->environment.'/*.yaml');
34 $routes->import($projectDir.'/config/{routes}/*.yaml');
35
36 if (is_file($projectDir.'/config/routes.yaml')) {
37 $routes->import($projectDir.'/config/routes.yaml');
38 } else {
39 $routes->import($projectDir.'/config/{routes}.php');
40 }
41 }
42 }