I posted this on #79 but I think it deserves it's own issue now that #98 has been merged. It appears that the in-memory object cache isn't following the principle of least surprise by allowing callbacks in DomainObjects save instances that were found in controllers.
e.g. We ran into this the other day:
Suppose CreditProduct #1 belongsTo Credit #1.
# In CreditProduct afterSave, we save the credit to bust caches, etc
# function afterSave(){
# $this->credit->save();
# }
# In a controller:
$credit = Credit::find(1);
$credit->reason = "Hello";
$credit_product = CreditProduct::create(array(
'credit_id' => $credit->id,
'product_id' => 2,
));
# "Hello" has been saved to the db as the credit reason,
# even though the afterSave function in CreditProduct should get a new instance.
I posted this on #79 but I think it deserves it's own issue now that #98 has been merged. It appears that the in-memory object cache isn't following the principle of least surprise by allowing callbacks in DomainObjects save instances that were found in controllers.
e.g. We ran into this the other day:
Suppose
CreditProduct #1
belongsToCredit #1
.