任何人都可以帮我解释我做错了吗?我尝试设置一个与文件相关的实体。它涉及供应商和库存。
我的股票实体看起来像
/**
* @ORM\ManyToOne(targetEntity="PrClientBundle\Entity\Lieferanten")
* @ORM\JoinColumn(name="liefer_id", referencedColumnName="id")
* @var lieferant
*/
private $lieferant;
我也使用getter和setter,如下面的
/**
* Set lieferant
*
* @param \PrClientBundle\Entity\Lieferanten $lieferant
* @return Leadbase
*/
public function setLieferant(\PrClientBundle\Entity\Lieferanten $lieferant = null)
{
$this->lieferant = $lieferant;
return $this;
}
/**
* Get lieferant
*
* @return \PrClientBundle\Entity\Lieferanten
*/
public function getLieferant()
{
return $this->lieferant;
}
当我导入新的Stockitems时:
$lead->setLieferant($lieferant);
我收到以下错误消息,我真的不明白:(
[Doctrine\ORM\ORMInvalidArgumentException]
A new entity was found through the relationship 'PrLeadBundle\Entity\Leadbase#lieferant' that was not configured to cascade persist operations for entity: PrClientBundle\Enti
ty\Lieferanten@000000002a45dae80000000002f826ff. 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"}). If you cannot find out which entity causes the problem implement 'PrClientBundle\Entity\Lieferante
n#__toString()' to get a clue.
如果你能帮助我理解我做错了什么,那将是非常好的。