Something along these lines causes duplicate entries:
Model_One and Model_Two have a many many relation successfully set up.
$obj1 = Model_Onet::find($one_ID);
$obj2 = Model_Twot::find($obj1_ID);
$obj1->twos[] = $obj;
$obj1->save();
//so far so good.
$obj3 = Model_Two::find($obj3_ID);
$obj1->twos[] = $obj3;
$obj1->save();
//here, in the many many relation table, we find that $obj2 was saved again, along with $obj3. (twice $obj2, once $obj3)
//if we continue...
$obj4 = Model_Two::find($obj4_ID);
$obj1->twos[] = $obj4;
$obj1->save();
//now in the many many relation table, $obj2 is repeated 3 times, $obj3 twice, and $obj4 once.
doesn't the orm check whether the object was already saved?
Something along these lines causes duplicate entries:
Model_One and Model_Two have a many many relation successfully set up.
doesn't the orm check whether the object was already saved?