Symfony entity no configured for cascade

71 views Asked by At

Can anyone help me explaining what I am doing wrong? I try to set an entity in relation to an file. Its about Supplier and Stock.

My Stock entity looks like

/**
 * @ORM\ManyToOne(targetEntity="PrClientBundle\Entity\Lieferanten")
 * @ORM\JoinColumn(name="liefer_id", referencedColumnName="id")
 * @var lieferant
 */
private $lieferant;

I also using getter and setter like following

    /**
 * 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;
}

When I import new Stockitems like:

$lead->setLieferant($lieferant);

I get the following errormessage which I really don't understand :(

[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.  

It would be very great if you could help me understanding what am I doing wrong.

0

There are 0 answers