Revize b332d98a
Přidáno uživatelem Tomáš Ballák před téměř 5 roky(ů)
website/src/Kernel.php | ||
---|---|---|
2 | 2 |
|
3 | 3 |
namespace App; |
4 | 4 |
|
5 |
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; |
|
6 |
use Symfony\Component\Config\Loader\LoaderInterface; |
|
5 |
use const PHP_VERSION_ID; |
|
7 | 6 |
use Symfony\Component\Config\Resource\FileResource; |
8 |
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
9 |
use Symfony\Component\HttpKernel\Kernel as BaseKernel; |
|
7 |
use Symfony\Component\Config\Loader\LoaderInterface; |
|
10 | 8 |
use Symfony\Component\Routing\RouteCollectionBuilder; |
9 |
use Symfony\Component\HttpKernel\Kernel as BaseKernel; |
|
10 |
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; |
|
11 |
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
12 |
use function dirname; |
|
11 | 13 |
|
12 |
class Kernel extends BaseKernel |
|
13 |
{ |
|
14 |
class Kernel extends BaseKernel { |
|
14 | 15 |
use MicroKernelTrait; |
15 | 16 |
|
16 | 17 |
private const CONFIG_EXTS = '.{php,xml,yaml,yml}'; |
17 | 18 |
|
18 |
public function registerBundles(): iterable |
|
19 |
{ |
|
19 |
public function registerBundles(): iterable { |
|
20 | 20 |
$contents = require $this->getProjectDir().'/config/bundles.php'; |
21 | 21 |
foreach ($contents as $class => $envs) { |
22 | 22 |
if ($envs[$this->environment] ?? $envs['all'] ?? false) { |
... | ... | |
25 | 25 |
} |
26 | 26 |
} |
27 | 27 |
|
28 |
public function getProjectDir(): string |
|
29 |
{ |
|
30 |
return \dirname(__DIR__); |
|
28 |
public function getProjectDir(): string { |
|
29 |
return dirname(__DIR__); |
|
31 | 30 |
} |
32 | 31 |
|
33 |
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void |
|
34 |
{ |
|
32 |
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void { |
|
35 | 33 |
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); |
36 |
$container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
|
|
34 |
$container->setParameter('container.dumper.inline_class_loader', PHP_VERSION_ID < 70400 || $this->debug); |
|
37 | 35 |
$container->setParameter('container.dumper.inline_factories', true); |
38 | 36 |
$confDir = $this->getProjectDir().'/config'; |
39 | 37 |
|
... | ... | |
43 | 41 |
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); |
44 | 42 |
} |
45 | 43 |
|
46 |
protected function configureRoutes(RouteCollectionBuilder $routes): void |
|
47 |
{ |
|
44 |
protected function configureRoutes(RouteCollectionBuilder $routes): void { |
|
48 | 45 |
$confDir = $this->getProjectDir().'/config'; |
49 | 46 |
|
50 | 47 |
$routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob'); |
Také k dispozici: Unified diff
Re #7986 devops refactor