Skip to content

Commit 2d6ab0f

Browse files
Merge branch '5.4' into 6.0
* 5.4: [VarDumper] Backport type fixes [Ldap] Backport refactorings [DependencyInjection] Optimize PHP preloading Introduced new method for getting bundles config path
2 parents 36e0d73 + 693ee6d commit 2d6ab0f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ CHANGELOG
2727
* Deprecate the `AdapterInterface` autowiring alias, use `CacheItemPoolInterface` instead
2828
* Deprecate the public `profiler` service to private
2929
* Deprecate `get()`, `has()`, `getDoctrine()`, and `dispatchMessage()` in `AbstractController`, use method/constructor injection instead
30+
* Add `MicroKernelTrait::getBundlesPath` method to get bundles config path
3031

3132
5.3
3233
---

Kernel/MicroKernelTrait.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function getLogDir(): string
8686
*/
8787
public function registerBundles(): iterable
8888
{
89-
$contents = require $this->getProjectDir().'/config/bundles.php';
89+
$contents = require $this->getBundlesPath();
9090
foreach ($contents as $class => $envs) {
9191
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
9292
yield new $class();
@@ -122,7 +122,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)
122122
$kernelDefinition->addTag('routing.route_loader');
123123

124124
$container->addObjectResource($this);
125-
$container->fileExists($this->getProjectDir().'/config/bundles.php');
125+
$container->fileExists($this->getBundlesPath());
126126

127127
try {
128128
$configureContainer = new \ReflectionMethod($this, 'configureContainer');
@@ -184,4 +184,12 @@ public function loadRoutes(LoaderInterface $loader): RouteCollection
184184

185185
return $collection;
186186
}
187+
188+
/**
189+
* Gets the path to the bundles configuration file.
190+
*/
191+
private function getBundlesPath(): string
192+
{
193+
return $this->getProjectDir().'/config/bundles.php';
194+
}
187195
}

0 commit comments

Comments
 (0)