|
21 | 21 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
22 | 22 | use Symfony\Component\DependencyInjection\Definition; |
23 | 23 | use Symfony\Component\DependencyInjection\Parameter; |
| 24 | +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; |
24 | 25 | use Symfony\Component\DependencyInjection\Reference; |
25 | 26 |
|
26 | 27 | final class SymfonyExtension implements Extension |
@@ -73,7 +74,7 @@ public function load(ContainerBuilder $container, array $config): void |
73 | 74 | { |
74 | 75 | $this->setupTestEnvironment($config['kernel']['environment'] ?? 'test'); |
75 | 76 |
|
76 | | - $this->loadBootstrap($this->autodiscoverBootstrap($config['bootstrap'])); |
| 77 | + $this->loadBootstrap($this->autodiscoverBootstrap($config['bootstrap'], $container->getParameterBag())); |
77 | 78 |
|
78 | 79 | $this->loadKernel($container, $this->autodiscoverKernelConfiguration($config['kernel'])); |
79 | 80 | $this->loadDriverKernel($container); |
@@ -232,26 +233,27 @@ private function autodiscoverKernelConfiguration(array $config): array |
232 | 233 | /** |
233 | 234 | * @param string|bool|null $bootstrap |
234 | 235 | */ |
235 | | - private function autodiscoverBootstrap($bootstrap): ?string |
| 236 | + private function autodiscoverBootstrap($bootstrap, ParameterBag $parameterBag): ?string |
236 | 237 | { |
237 | 238 | if (is_string($bootstrap)) { |
238 | | - return $bootstrap; |
| 239 | + return $parameterBag->resolveString($bootstrap); |
239 | 240 | } |
240 | 241 |
|
241 | 242 | if ($bootstrap === false) { |
242 | 243 | return null; |
243 | 244 | } |
244 | 245 |
|
245 | 246 | $autodiscovered = 0; |
| 247 | + $basePath = $parameterBag->get('paths.base'); |
246 | 248 |
|
247 | | - if (file_exists('config/bootstrap.php')) { |
248 | | - $bootstrap = 'config/bootstrap.php'; |
| 249 | + if (file_exists($basePath . '/config/bootstrap.php')) { |
| 250 | + $bootstrap = $basePath . '/config/bootstrap.php'; |
249 | 251 |
|
250 | 252 | ++$autodiscovered; |
251 | 253 | } |
252 | 254 |
|
253 | | - if (file_exists('app/autoload.php')) { |
254 | | - $bootstrap = 'app/autoload.php'; |
| 255 | + if (file_exists($basePath . '/app/autoload.php')) { |
| 256 | + $bootstrap = $basePath . '/app/autoload.php'; |
255 | 257 |
|
256 | 258 | ++$autodiscovered; |
257 | 259 | } |
|
0 commit comments