Skip to content

Restore doctrine.connections after kernel shutdown#244

Merged
TavoNiievez merged 2 commits into
Codeception:mainfrom
d-mitrofanov-v:fix/restore-doctrine-connections-after-kernel-reboot
Jul 10, 2026
Merged

Restore doctrine.connections after kernel shutdown#244
TavoNiievez merged 2 commits into
Codeception:mainfrom
d-mitrofanov-v:fix/restore-doctrine-connections-after-kernel-reboot

Conversation

@d-mitrofanov-v

Copy link
Copy Markdown
Contributor

Hi guys! After updating to 3.10 in my projects, all tests started failing with error:

[Warning] Undefined array key "doctrine.connections" at /var/www/var/cache/test/ContainerKbNY0zx/App_KernelTestDebugContainer.php:1629

The combined changes in persistDoctrineConnections in 3.9.0 and in _getEntityManager in 3.10.0 opened this bug, because Symfony::rebootKernel() removes doctrine.connections to prevent DoctrineBundle from closing the persistent DBAL connection during kernel shutdown and this parameter is never restored, leaving the previous container broken.

Tried to make a minimal change. We remove the parameter in the kernel shutdown phase and restores it afterward. The restoration is also done when kernel shutdown throws. The DBAL connection stays persistent, while the entity manager is still recreated from the current container.

@TavoNiievez

Copy link
Copy Markdown
Member

Hi @d-mitrofanov-v Please create a test similar to:
https://github.com/Codeception/symfony-module-tests/blob/a816870d80a89fa89367bf10e9324315c70b3abd/tests/Functional/IssuesCest.php#L21
in the symfony-module-tests project
to verify the regression you mentioned, implement the change, and ensure that it won't fail again in the future.

@d-mitrofanov-v

Copy link
Copy Markdown
Contributor Author

@TavoNiievez hi. Done - Codeception/symfony-module-tests#67

@TavoNiievez TavoNiievez force-pushed the fix/restore-doctrine-connections-after-kernel-reboot branch from 618224d to f797a36 Compare July 10, 2026 19:32
@TavoNiievez TavoNiievez merged commit 01cfa3e into Codeception:main Jul 10, 2026
1 of 7 checks passed
@TavoNiievez

Copy link
Copy Markdown
Member

@d-mitrofanov-v Released as 3.10.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants