src/Kernel.php line 44

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace App;
  11. use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
  12. use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
  13. use Symfony\Component\HttpKernel\Kernel as BaseKernel;
  14. use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
  15. class Kernel extends BaseKernel
  16. {
  17.     use MicroKernelTrait;
  18.     protected function configureContainer(ContainerConfigurator $container): void
  19.     {
  20.         $kernelMode $_ENV["KERNEL_MODE"];
  21.         $kernelApplication $_ENV["KERNEL_APPLICATION"];
  22.         $container->import('../config/{packages}/*.yaml');
  23.         $container->import('../config/{packages}/'.$this->environment.'/*.yaml');
  24.         if (is_file(\dirname(__DIR__).'/config/services.yaml')) {
  25.             $container->import('../config/services.yaml');
  26.             $container->import('../config/{services}_'.$this->environment.'.yaml');
  27.         } elseif (is_file($path \dirname(__DIR__).'/config/services.php')) {
  28.             (require $path)($container->withPath($path), $this);
  29.         }
  30.         if(!empty($kernelApplication)) {
  31.             $container->import('../config/services_'.$kernelApplication.'.yaml');
  32.         }
  33.     }
  34.     protected function configureRoutes(RoutingConfigurator $routes): void
  35.     {
  36.         $routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
  37.         $routes->import('../config/{routes}/*.yaml');
  38.         if (is_file(\dirname(__DIR__).'/config/routes.yaml')) {
  39.             $routes->import('../config/routes.yaml');
  40.         } elseif (is_file($path \dirname(__DIR__).'/config/routes.php')) {
  41.             (require $path)($routes->withPath($path), $this);
  42.         }
  43.         $kernelMode $_ENV["KERNEL_MODE"];
  44.         $kernelApplication $_ENV["KERNEL_APPLICATION"];
  45.         if($kernelMode == "vitrine") {
  46.             $routes->import('../config/routes_vitrine.yaml');
  47.             if(!empty($kernelApplication)) {
  48.                 $routes->import('../config/routes_application_'.$kernelApplication.'.yaml');
  49.             }
  50.         } else {
  51.             if(!empty($kernelApplication)) {
  52.                 $routes->import('../config/routes_application_vitrine_'.$kernelApplication.'.yaml');
  53.             }
  54.         }
  55.     }
  56. }