Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doctrine 2.1: how to set "cascade: persist" using yaml

I get an error when I try to do

$b = new B();
$a->addB($b);
$entityManager->persist($a);

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)

Cheers

like image 419
mkk Avatar asked Nov 04 '11 12:11

mkk


1 Answers

This works for me

oneToMany:
    products:
      targetEntity: Name
      mappedBy: product
      cascade: ["persist"]
like image 189
mkk Avatar answered Sep 28 '22 00:09

mkk