【发布时间】:2015-08-19 14:37:26
【问题描述】:
我对 Doctrine 常见错误有一个奇怪的错误:
CRITICAL: Uncaught PHP Exception Doctrine\ORM\ORMInvalidArgumentException: "A new entity was found through the relationship 'Isc\CoreBundle\Entity\Orders#ordersProducts' that was not configured to cascade persist operations for entity: Isc\CoreBundle\Entity\OrdersProducts@000000000888648200000000198a79af
Strangeless 是错误频率。我们可以使用该编程代码处理 5000 个订单,并且一切正常。但是第5001个订单会产生这个错误,我们不会保存ordersProducts。
我搜索了解决方案,但我找到的所有内容(如 Doctrine - A new entity was found through the relationship、https://groups.google.com/forum/#!topic/doctrine-user/bdY1QgM4Tu4 等)都对我没有帮助。
此外,生产环境中出现了与大量服务器一起工作的错误。在具有一台服务器的开发人员环境中,它运行良好。
在日志中它可能看起来像(用户总是有一个会话 id):
- www1 - 访问过的产品页面
- www1 - 在购物车中添加了 product1
- www2 - 在购物车中添加了 product2
- www7 - 访问过的购物车
- www2 - 选择支付宝
- www2 - 初始化订单(并使用 orderProducts 将其保存在数据库中)
- www4 - 向贝宝发送数据并将用户重定向到付款
- www3 - 从 Paypal 获取有关付款的请求 - 尝试更新订单和 orderProducts - 此处生成异常
有人遇到过类似的 Doctrina 问题吗? 这可能是因为我们使用的服务器很少吗?
“好”订单和“坏”订单的编程代码始终相同
附言php5.4; symfony2; mysql
【问题讨论】:
标签: mysql symfony doctrine entity