原则2.1:如何设置“级联:持续”?使用yaml [英] Doctrine 2.1: how to set "cascade: persist" using yaml
本文介绍了原则2.1:如何设置“级联:持续”?使用yaml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试执行操作时出现错误
I get an error when I try to do
$b = new B();
$a->addB($b);
$entityManager->persist($a);
因为我首先需要坚持$ b,但是我不能这样做,所以我需要设置级联:坚持,我相信。我只是在文档中找不到如何使用yaml模式执行此操作。
文档不涵盖此部分(
because I first need to persist $b, however I cannot do this, so I need to set cascade: persist I believe. I just cannot find in documentation how to do this using yaml schema. Documentation does not cover this part ( I tried in other places in documentation as well)
欢呼声
推荐答案
这对我有用
oneToMany:
products:
targetEntity: Name
mappedBy: product
cascade: ["persist"]
这篇关于原则2.1:如何设置“级联:持续”?使用yaml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文