Skip to content

Commit 339bf31

Browse files
author
symfony-flex-server[bot]
authored
Merge pull request #690
2 parents 4fcfbbe + 95e75e5 commit 339bf31

File tree

6 files changed

+59
-0
lines changed

6 files changed

+59
-0
lines changed

symfony/framework-bundle/5.1/config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../4.4/config
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../4.4/manifest.json
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../4.4/post-install.txt

symfony/framework-bundle/5.1/public

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../4.4/public
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../4.4/src/Controller
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
namespace App;
4+
5+
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
6+
use Symfony\Component\Config\Loader\LoaderInterface;
7+
use Symfony\Component\Config\Resource\FileResource;
8+
use Symfony\Component\DependencyInjection\ContainerBuilder;
9+
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
10+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
11+
12+
class Kernel extends BaseKernel
13+
{
14+
use MicroKernelTrait;
15+
16+
private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
17+
18+
public function registerBundles(): iterable
19+
{
20+
$contents = require $this->getProjectDir().'/config/bundles.php';
21+
foreach ($contents as $class => $envs) {
22+
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
23+
yield new $class();
24+
}
25+
}
26+
}
27+
28+
public function getProjectDir(): string
29+
{
30+
return \dirname(__DIR__);
31+
}
32+
33+
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
34+
{
35+
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
36+
$container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || !ini_get('opcache.preload'));
37+
$container->setParameter('container.dumper.inline_factories', true);
38+
$confDir = $this->getProjectDir().'/config';
39+
40+
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
41+
$loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
42+
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
43+
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
44+
}
45+
46+
protected function configureRouting(RoutingConfigurator $routes): void
47+
{
48+
$confDir = $this->getProjectDir().'/config';
49+
50+
$routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
51+
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, 'glob');
52+
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, 'glob');
53+
}
54+
}

0 commit comments

Comments
 (0)