8000 [Configuration] Using MicroKernelTrait::getBundlesPath with Multiple Kernels by a-menshchikov · Pull Request #15423 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Configuration] Using MicroKernelTrait::getBundlesPath with Multiple Kernels #15423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions configuration/multiple_kernels.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,9 @@ files so they don't collide with the files from ``src/Kernel.php``::
{
use MicroKernelTrait;

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

public function getCacheDir(): string
Expand Down Expand Up @@ -131,6 +125,12 @@ files so they don't collide with the files from ``src/Kernel.php``::
$routes->import('../config/api/{routes}/*.yaml');
// ... load only the config routes strictly needed for the API
}

private function getBundlesPath(): string
{
// load only the bundles strictly needed for the API
return $this->getProjectDir().'/config/api_bundles.php';
}
}

Step 3) Define the Kernel Configuration
Expand Down
0