Propel icon indicating copy to clipboard operation
Propel copied to clipboard

Save cascade with new one/many-to-many objects

Open williamhector opened this issue 10 years ago • 0 comments

This is more of a feature request than an issue, and I couldn't find an existing similar issue.

We have a one-to-many relationship and have a case where we're creating new rows of each at the same time. Eg

$a = new A();
$b = new B();
$b->setA($a);
$a->addB($b);
$a->save();

However that doesn't work, because $b->setA($a); relies on $a having an id at that point, and $a only gets an id on insert.

I have a few (probably dumb) ideas on how this could be approached. Has this been discussed before and is it desirable to cover this use case?

williamhector avatar Oct 20 '15 21:10 williamhector