A new entity was found through the relationship *** that was not configured to cascade persist operations for entity

谁都会走 提交于 2019-12-25 09:48:53

问题


I'm currently creating some fixtures for some tests and i faced this error. Have you an idea about how to solve it ?

I've so many fixtures to copy paste it.

A new entity was found through the relationship '***' that was not configured to cascade persist operations for entity: 
***. To solve this issue: Either explicitly call EntityManager#persist() on     
this unknown entity or configure cascade persist  this association in the 
mapping for example @OneToOne(..,cascade={"persist"}). If you cannot find 
out which entity causes the problem implement '***#__toString()' to get a clue.

回答1:


The error means that there is a related entity in a current object that has not been saved to the database yet. You either need to make sure your relationship is set to cascade persist calls (meaning it will save this automatically) or you need to persist the unsaved entity before saving the current entity.



来源:https://stackoverflow.com/questions/40373891/a-new-entity-was-found-through-the-relationship-that-was-not-configured-to-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!