通过关系***找到了一个新实体,该关系没有配置为实体的级联持久化操作


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

我目前正在为一些测试创建一些fixture,并且我面临此错误。你知道如何解决这个问题吗?

我有很多固定装置要复制粘贴。

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.

该错误表示当前对象中有一个相关实体尚未保存到数据库中。您要么需要确保将关系设置为级联持久化调用(意味着它将自动保存此调用),要么需要在保存当前实体之前持久化未保存的实体。