File tree 2 files changed +19
-0
lines changed
src/Symfony/Bundle/FrameworkBundle
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ CHANGELOG
7
7
* Marked ` MicroKernelTrait::configureRoutes() ` as ` @internal ` and ` @final ` .
8
8
* Deprecated not overriding ` MicroKernelTrait::configureRouting() ` .
9
9
* Added a new ` mailer.message_bus ` option to configure or disable the message bus to use to send mails.
10
+ * Added flex-based default implementation for ` MicroKernelTrait::registerBundles() `
10
11
11
12
5.0.0
12
13
-----
Original file line number Diff line number Diff line change 12
12
namespace Symfony \Bundle \FrameworkBundle \Kernel ;
13
13
14
14
use Symfony \Component \Config \Loader \LoaderInterface ;
15
+ use Symfony \Component \Config \Resource \FileResource ;
15
16
use Symfony \Component \DependencyInjection \ContainerBuilder ;
16
17
use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
17
18
use Symfony \Component \Routing \Loader \Configurator \RoutingConfigurator ;
@@ -72,6 +73,19 @@ protected function configureRouting(RoutingConfigurator $routes): void
72
73
*/
73
74
abstract protected function configureContainer (ContainerBuilder $ c , LoaderInterface $ loader );
74
75
76
+ /**
77
+ * {@inheritdoc}
78
+ */
79
+ public function registerBundles (): iterable
80
+ {
81
+ $ contents = require $ this ->getProjectDir ().'/config/bundles.php ' ;
82
+ foreach ($ contents as $ class => $ envs ) {
83
+ if ($ envs [$ this ->environment ] ?? $ envs ['all ' ] ?? false ) {
84
+ yield new $ class ();
85
+ }
86
+ }
87
+ }
88
+
75
89
/**
76
90
* {@inheritdoc}
77
91
*/
@@ -99,6 +113,10 @@ public function registerContainerConfiguration(LoaderInterface $loader)
99
113
$ kernelDefinition ->addTag ('kernel.event_subscriber ' );
100
114
}
101
115
116
+ $ container ->fileExists ($ this ->getProjectDir ().'/config/bundles.php ' );
117
+ $ container ->setParameter ('container.dumper.inline_class_loader ' , \PHP_VERSION_ID < 70400 || !ini_get ('opcache.preload ' ));
118
+ $ container ->setParameter ('container.dumper.inline_factories ' , true );
119
+
102
120
$ this ->configureContainer ($ container , $ loader );
103
121
104
122
$ container ->addObjectResource ($ this );
You can’t perform that action at this time.
0 commit comments