Skip to content

Commit d737051

Browse files
committed
Allowing php config in the kernel
1 parent 81543c6 commit d737051

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

symfony/framework-bundle/5.1/src/Kernel.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,26 @@ protected function configureContainer(ContainerConfigurator $container): void
1515
{
1616
$container->import('../config/{packages}/*.yaml');
1717
$container->import('../config/{packages}/'.$this->environment.'/*.yaml');
18-
$container->import('../config/{services}.yaml');
19-
$container->import('../config/{services}_'.$this->environment.'.yaml');
18+
19+
if (file_exists(\dirname(__DIR__).'/config/services.yaml')) {
20+
$container->import('../config/{services}.yaml');
21+
$container->import('../config/{services}_'.$this->environment.'.yaml');
22+
} else {
23+
$path = \dirname(__DIR__).'/config/services.php';
24+
(require $path)($container->withPath($path), $this);
25+
}
2026
}
2127

2228
protected function configureRoutes(RoutingConfigurator $routes): void
2329
{
2430
$routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
2531
$routes->import('../config/{routes}/*.yaml');
26-
$routes->import('../config/{routes}.yaml');
32+
33+
if (file_exists(\dirname(__DIR__).'/config/routes.yaml')) {
34+
$routes->import('../config/{routes}.yaml');
35+
} else {
36+
$path = \dirname(__DIR__).'/config/routes.php';
37+
(require $path)($routes->withPath($path), $this);
38+
}
2739
}
2840
}

0 commit comments

Comments
 (0)