Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

In-Memory cache updating remote objects? #110

Open
Jud opened this issue May 8, 2014 · 0 comments
Open

In-Memory cache updating remote objects? #110

Jud opened this issue May 8, 2014 · 0 comments

Comments

@Jud
Copy link
Collaborator

Jud commented May 8, 2014

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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant