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
This works for me
oneToMany:
products:
targetEntity: Name
mappedBy: product
cascade: ["persist"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With