8000 Introduced new method for getting bundles config path · symfony/framework-bundle@648b979 · GitHub
[go: up one dir, main page]

8000 Skip to content

Commit 648b979

Browse files
committed
Introduced new method for getting bundles config path
1 parent 794b5e1 commit 648b979

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
@@ -8,6 +8,7 @@ CHANGELOG
88
* Deprecate the `AdapterInterface` autowiring alias, use `CacheItemPoolInterface` instead
99
* Deprecate the public `profiler` service to private
1010
* Deprecate `get()`, `has()`, `getDoctrine()`, and `dispatchMessage()` in `AbstractController`, use method/constructor injection instead
11+
* Add `MicroKernelTrait::getBundlesPath` method to get bundles config path
1112

1213
5.3
1314
---

Kernel/MicroKernelTrait.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getLogDir(): string
8888
*/
8989
public function registerBundles(): iterable
9090
{
91-
$contents = require $this->getProjectDir().'/config/bundles.php';
91+
$contents = require $this->getBundlesPath();
9292
foreach ($contents as $class => $envs) {
9393
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
949 8000 4
yield new $class();
@@ -124,7 +124,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)
124124
$kernelDefinition->addTag('routing.route_loader');
125125

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

129129
try {
130130
$configureContainer = new \ReflectionMethod($this, 'configureContainer');
@@ -203,4 +203,12 @@ public function loadRoutes(LoaderInterface $loader): RouteCollection
203203

204204
return $collection;
205205
}
206+
207+
/**
208+
* Gets the path to the bundles configuration file.
209+
*/
210+
private function getBundlesPath(): string
211+
{
212+
return $this->getProjectDir().'/config/bundles.php';
213+
}
206214
}

0 commit comments

Comments
 (0)
0