我在使用$em->flush()
時遇到問題; 對象$的教育持續拋出$em->persist ($education)
。 該位置是我項目中的一個實體,與教育實體有關,可以拋出多對一的關係。
錯誤盒子裏裝的:
A new entity was found through the relationship 'XBundle\Entity\Education#location' that was not configured to cascade persist operations for entity: NewYork. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={"persist"}).
我怎樣才能解決這個問題呢?
我很抱歉,但即使我添加級聯= {問題仍然存在:如果您使用的docblock批註指定您的數據庫架構,這是通過將級聯屬性您@ManyToOne協會實現「堅持」}在我的實體文件中。 – user3110618