zend-blog-3-backend

Форк
0
66 строк · 2.2 Кб
1
<?php
2

3
namespace App;
4

5
use App\DependencyInjection\CronCompilerPass;
6
use App\DependencyInjection\Security\Factory\WsseFactory;
7
use App\DependencyInjection\TelegramCompilerPass;
8
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
11
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
12
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
13

14
class Kernel extends BaseKernel
15
{
16
    use MicroKernelTrait;
17

18
    public function __construct(string $environment, bool $debug)
19
    {
20
        parent::__construct($environment, $debug);
21

22
        if (!defined('APP_VAR_DIR')) {
23
            define('APP_VAR_DIR', dirname(__DIR__, 2) . '/var');
24
        }
25
        if (!defined('APP_WEB_DIR')) {
26
            define('APP_WEB_DIR', dirname(__DIR__, 2) . '/web');
27
        }
28
    }
29

30
    public function getProjectDir(): string
31
    {
32
        return dirname(__DIR__, 2);
33
    }
34

35
    public function build(ContainerBuilder $container): void
36
    {
37
        $container->addCompilerPass(new CronCompilerPass());
38
        $container->addCompilerPass(new TelegramCompilerPass());
39

40
        $extension = $container->getExtension('security');
41
        $extension->addSecurityListenerFactory(new WsseFactory());
42
    }
43

44
    protected function configureContainer(ContainerConfigurator $container): void
45
    {
46
        $confDir = $this->getProjectDir() . '/config';
47

48
        $container->import($confDir . '/{packages}/*.yaml');
49
        $container->import($confDir . '/{packages}/' . $this->environment . '/*.yaml');
50
        if (is_file($confDir . '/services.yaml')) {
51
            $container->import($confDir . '/services.yaml');
52
            $container->import($confDir . '/{services}_' . $this->environment . '.yaml');
53
        }
54
    }
55

56
    protected function configureRoutes(RoutingConfigurator $routes): void
57
    {
58
        $confDir = $this->getProjectDir() . '/config';
59

60
        $routes->import($confDir . '/{routes}/' . $this->environment . '/*.yaml');
61
        $routes->import($confDir . '/{routes}/*.yaml');
62
        if (is_file($confDir . '/routes.yaml')) {
63
            $routes->import($confDir . '/routes.yaml');
64
        }
65
    }
66
}
67

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.