8000 minor #15423 [Configuration] Using MicroKernelTrait::getBundlesPath w… · symfony/symfony-docs@438afbf · GitHub
[go: up one dir, main page]

Skip to content

Commit 438afbf

Browse files
committed
minor #15423 [Configuration] Using MicroKernelTrait::getBundlesPath with Multiple Kernels (a-menshchikov)
This PR was merged into the 5.4 branch. Discussion ---------- [Configuration] Using MicroKernelTrait::getBundlesPath with Multiple Kernels See symfony/symfony#41566 Commits ------- a69f6b3 MicroKernelTrait::getBundlesPath
2 parents 6d6ad2e + a69f6b3 commit 438afbf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

configuration/multiple_kernels.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,9 @@ files so they don't collide with the files from ``src/Kernel.php``::
9191
{
9292
use MicroKernelTrait;
9393

94-
public function registerBundles()
94+
public function getProjectDir(): string
9595
{
96-
// load only the bundles strictly needed for the API
97-
$contents = require $this->getProjectDir().'/config/api_bundles.php';
98-
foreach ($contents as $class => $envs) {
99-
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
100-
yield new $class();
101-
}
102-
}
96+
return \dirname(__DIR__);
10397
}
10498

10599
public function getCacheDir(): string
@@ -131,6 +125,12 @@ files so they don't collide with the files from ``src/Kernel.php``::
131125
$routes->import('../config/api/{routes}/*.yaml');
132126
// ... load only the config routes strictly needed for the API
133127
}
128+
129+
private function getBundlesPath(): string
130+
{
131+
// load only the bundles strictly needed for the API
132+
return $this->getProjectDir().'/config/api_bundles.php';
133+
}
134134
}
135135

136136
Step 3) Define the Kernel Configuration

0 commit comments

Comments
 (0)
0