Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

4 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App;
  3. use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
  4. use Symfony\Component\Config\Loader\LoaderInterface;
  5. use Symfony\Component\Config\Resource\FileResource;
  6. use Symfony\Component\DependencyInjection\ContainerBuilder;
  7. use Symfony\Component\HttpKernel\Kernel as BaseKernel;
  8. use Symfony\Component\Routing\RouteCollectionBuilder;
  9. class Kernel extends BaseKernel
  10. {
  11. use MicroKernelTrait;
  12. private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
  13. public function registerBundles(): iterable
  14. {
  15. $contents = require $this->getProjectDir().'/config/bundles.php';
  16. foreach ($contents as $class => $envs) {
  17. if ($envs[$this->environment] ?? $envs['all'] ?? false) {
  18. yield new $class();
  19. }
  20. }
  21. }
  22. public function getProjectDir(): string
  23. {
  24. return \dirname(__DIR__);
  25. }
  26. protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
  27. {
  28. $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
  29. $container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
  30. $container->setParameter('container.dumper.inline_factories', true);
  31. $confDir = $this->getProjectDir().'/config';
  32. $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
  33. $loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
  34. $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
  35. $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
  36. }
  37. protected function configureRoutes(RouteCollectionBuilder $routes): void
  38. {
  39. $confDir = $this->getProjectDir().'/config';
  40. $routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob');
  41. $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
  42. $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
  43. }
  44. }