From a69f6b3c0e56d02868ff8b0cdbafafd6a43cb453 Mon Sep 17 00:00:00 2001 From: Alexander Menshchikov Date: Tue, 8 Jun 2021 14:20:08 +0300 Subject: [PATCH] MicroKernelTrait::getBundlesPath --- configuration/multiple_kernels.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/configuration/multiple_kernels.rst b/configuration/multiple_kernels.rst index bed2b75a60c..4bea4797349 100644 --- a/configuration/multiple_kernels.rst +++ b/configuration/multiple_kernels.rst @@ -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 @@ -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