After Symfony Kernel reboot - Doctrine EventManager keep old Container
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 领域
- backend, testing-qa
调研方向
使用文档中记录的 git checkout、composer install 和 vendor/bin/codecept run 命令运行 tests/functional/ContainerCest.php 中的复现步骤。检查 Symfony 内核重启路径、doctrine.orm.entity_manager 持久性和 ContainerAwareEventManager,以确认旧容器为何仍被引用。完成标准是回归测试证明容器使用一致,或者在未选择修复方案时记录该限制。
由索引模型根据 Issue 内容生成。
描述
What are you trying to achieve?
I have case, when my service have some state, like MemoryStorage collect some data and I want to test what it collects. This MemoryStorage filled by some listeners, subscribed to Doctrine events.
What do you get instead?
My MemoryStorage empty.
Here is reproduce test https://github.com/ewgRa/symfony-standard/blob/codeception-bug-with-container/tests/functional/ContainerCest.php .
tryToTest failed, and tryToTestProof show the reason why it fail.
Problem that doctrine.orm.entity_manager is persistent service and it have EventManager, that actually ContainerAwareEventManager, that store container.
When Symfony module reboot kernel, it create new Container, but since doctrine is persistent, EventManager continue keep old container.
As a result Doctrine events work with its own container, while $I->grabService(...) work with another container.
Reproduce:
git clone [email protected]:ewgRa/symfony-standard.git
cd symfony-standard/
git checkout codeception-bug-with-container
composer install
vendor/bin/codecept run
So, is it feature? Or bug? Looks like 100% bug. Possible solution is update EventManager container also on kernel reboot. Or another solution - unpersist doctrine.
At least this must be mentioned somehow in documentation. Also some "I make service persistent, and it not works" issues can be related to this.
- 主要语言
- PHP
- 星标
- 4
- 派生
- 2
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Codeception/module-doctrine 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 38/100
-
难度 4/5 3-5 天 新手友好度 30/100
-
难度 4/5 3-5 天 新手友好度 35/100
Codeception/module-doctrine#2 · 1 条评论 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 42/100
-
难度 3/5 1-2 天 新手友好度 64/100
Codeception/module-doctrine#6 · 1 条评论 ·
查看 Codeception/module-doctrine 的全部 Issue
相似的 Issue
-
sync-en
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
sync-en
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 4 天内回复
-
Перевод устарел
难度 1/5 1 小时以内 新手友好度 85/100
-
bug
难度 2/5 半天 新手友好度 76/100
m3ue/m3u-editor#1604 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
femiwiki/docker-mediawiki#1497 ·
维护者通常 1 天内回复