Skip to content
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
26 changes: 14 additions & 12 deletions src/Codeception/Lib/Connector/Symfony.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ public function rebootKernel(): void
{
$this->updatePersistentServices();

$this->persistDoctrineConnections();

if ($this->kernel instanceof Kernel) {
$this->ensureKernelShutdown();
$this->kernel->boot();
Expand All @@ -72,7 +70,20 @@ public function rebootKernel(): void
protected function ensureKernelShutdown(): void
{
$this->kernel->boot();
$this->kernel->shutdown();

$kernel = $this->kernel;
(function () use ($kernel): void {
if (!property_exists($this, 'parameters') || !is_array($this->parameters)) {
$kernel->shutdown();
return;
}
$connections = $this->parameters['doctrine.connections'] ?? null;
unset($this->parameters['doctrine.connections']);
$kernel->shutdown();
if ($connections !== null) {
$this->parameters['doctrine.connections'] = $connections;
}
})->call($kernel->getContainer());
}

private function resolveContainer(): ContainerInterface
Expand All @@ -98,15 +109,6 @@ private function getProfiler(): ?Profiler
return null;
}

private function persistDoctrineConnections(): void
{
(function (): void {
if (property_exists($this, 'parameters') && is_array($this->parameters)) {
unset($this->parameters['doctrine.connections']);
}
})->call($this->kernel->getContainer());
}

private function updatePersistentServices(): void
{
foreach ($this->persistentServices as $name => $_) {
Expand Down