8000 Introduced new method for getting bundles config path · symfony/symfony@464a2cb · GitHub
[go: up one dir, main page]

Skip to content

Commit 464a2cb

Browse files
committed
Introduced new method for getting bundles config path
1 parent 1e3c875 commit 464a2cb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* Add autowiring alias for `HttpCache\StoreInterface`
88
* Deprecate the `AdapterInterface` autowiring alias, use `CacheItemPoolInterface` instead
99
* Deprecate the public `profiler` service to private
10+
* Add `MicroKernelTrait::getBundlesPath` method to get bundles config path
1011

1112
5.3
1213
---

src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,20 @@ public function getLogDir(): string
8383
return $_SERVER['APP_LOG_DIR'] ?? parent::getLogDir();
8484
}
8585

86+
/**
87+
* Gets the path to the bundles configuration file.
88+
*/
89+
public function getBundlesPath(): string
90+
{
91+
return $this->getProjectDir().'/config/bundles.php';
92+
}
93+
8694
/**
8795
* {@inheritdoc}
8896
*/
8997
public function registerBundles(): iterable
9098
{
91-
$contents = require $this->getProjectDir().'/config/bundles.php';
99+
$contents = require $this->getBundlesPath();
92100
foreach ($contents as $class => $envs) {
93101
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
94102
yield new $class();
@@ -124,7 +132,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)
124132
$kernelDefinition->addTag('routing.route_loader');
125133

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

129137
try {
130138
$configureContainer = new \ReflectionMethod($this, 'configureContainer');

0 commit comments

Comments
 (0)
0