src/Kernel.php line 50

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.         $kernelMode $_ENV["KERNEL_MODE"];
  37.         $kernelApplication $_ENV["KERNEL_APPLICATION"];
  38.         $routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
  39.         $routes->import('../config/{routes}/*.yaml');
  40.         if (is_file(\dirname(__DIR__).'/config/routes.yaml')) {
  41.             $routes->import('../config/routes.yaml');
  42.         } elseif (is_file($path \dirname(__DIR__).'/config/routes.php')) {
  43.             (require $path)($routes->withPath($path), $this);
  44.         }
  45.         if($kernelMode == "vitrine") {
  46.             $routes->import('../config/routes_login.yaml');
  47.             if(!empty($kernelApplication)) {
  48.                 $routes->import('../config/routes_application_' $kernelApplication '.yaml');
  49.             }
  50.             $routes->import('../config/routes_vitrine.yaml');
  51.         } else {
  52.             if(!empty($kernelApplication)) {
  53.                 $routes->import('../config/routes_login.yaml');
  54.                 $routes->import('../config/routes_application_vitrine_'.$kernelApplication.'.yaml');
  55.             }
  56.         }
  57.     }
  58. }