@@ -55,8 +55,6 @@ public function rebootKernel(): void
5555 {
5656 $ this ->updatePersistentServices ();
5757
58- $ this ->persistDoctrineConnections ();
59-
6058 if ($ this ->kernel instanceof Kernel) {
6159 $ this ->ensureKernelShutdown ();
6260 $ this ->kernel ->boot ();
@@ -72,7 +70,20 @@ public function rebootKernel(): void
7270 protected function ensureKernelShutdown (): void
7371 {
7472 $ this ->kernel ->boot ();
75- $ this ->kernel ->shutdown ();
73+
74+ $ kernel = $ this ->kernel ;
75+ (function () use ($ kernel ): void {
76+ if (!property_exists ($ this , 'parameters ' ) || !is_array ($ this ->parameters )) {
77+ $ kernel ->shutdown ();
78+ return ;
79+ }
80+ $ connections = $ this ->parameters ['doctrine.connections ' ] ?? null ;
81+ unset($ this ->parameters ['doctrine.connections ' ]);
82+ $ kernel ->shutdown ();
83+ if ($ connections !== null ) {
84+ $ this ->parameters ['doctrine.connections ' ] = $ connections ;
85+ }
86+ })->call ($ kernel ->getContainer ());
7687 }
7788
7889 private function resolveContainer (): ContainerInterface
@@ -98,15 +109,6 @@ private function getProfiler(): ?Profiler
98109 return null ;
99110 }
100111
101- private function persistDoctrineConnections (): void
102- {
103- (function (): void {
104- if (property_exists ($ this , 'parameters ' ) && is_array ($ this ->parameters )) {
105- unset($ this ->parameters ['doctrine.connections ' ]);
106- }
107- })->call ($ this ->kernel ->getContainer ());
108- }
109-
110112 private function updatePersistentServices (): void
111113 {
112114 foreach ($ this ->persistentServices as $ name => $ _ ) {
0 commit comments