File tree 2 files changed +26
-0
lines changed
src/Symfony/Bundle/FrameworkBundle
2 files changed +26
-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-compatible default implementations for ` MicroKernelTrait::registerBundles() ` and ` getProjectDir() `
10
11
11
12
5.0.0
12
13
-----
Original file line number Diff line number Diff line change @@ -72,6 +72,27 @@ protected function configureRouting(RoutingConfigurator $routes): void
72
72
*/
73
73
abstract protected function configureContainer (ContainerBuilder $ c , LoaderInterface $ loader );
74
74
75
+ /**
76
+ * {@inheritdoc}
77
+ */
78
+ public function getProjectDir (): string
79
+ {
80
+ return \dirname ((new \ReflectionObject ($ this ))->getFileName (), 2 );
81
+ }
82
+
83
+ /**
84
+ * {@inheritdoc}
85
+ */
86
+ public function registerBundles (): iterable
87
+ {
88
+ $ contents = require $ this ->getProjectDir ().'/config/bundles.php ' ;
89
+ foreach ($ contents as $ class => $ envs ) {
90
+ if ($ envs [$ this ->environment ] ?? $ envs ['all ' ] ?? false ) {
91
+ yield new $ class ();
92
+ }
93
+ }
94
+ }
95
+
75
96
/**
76
97
* {@inheritdoc}
77
98
*/
@@ -99,6 +120,10 @@ public function registerContainerConfiguration(LoaderInterface $loader)
99
120
$ kernelDefinition ->addTag ('kernel.event_subscriber ' );
100
121
}
101
122
123
+ $ container ->fileExists ($ this ->getProjectDir ().'/config/bundles.php ' );
124
+ $ container ->setParameter ('container.dumper.inline_class_loader ' , \PHP_VERSION_ID < 70400 );
125
+ $ container ->setParameter ('container.dumper.inline_factories ' , true );
126
+
102
127
$ this ->configureContainer ($ container , $ loader );
103
128
104
129
$ container ->addObjectResource ($ this );
You can’t perform that action at this time.
0 commit comments