Don't pass MY_ORM::original() to update event handlers, since after

parent::save() it'll be reset.  Clone it first.

This is an alternate fix for #978.
This commit is contained in:
Bharat Mediratta
2010-01-16 00:13:28 -08:00
parent 9f03d36d6e
commit dcf4b5e71a
4 changed files with 12 additions and 4 deletions

View File

@@ -65,12 +65,14 @@ class Comment_Model extends ORM {
}
}
$visible_change = $this->original()->state == "published" || $this->state == "published";
$original = clone $this->original();
parent::save();
if (isset($created)) {
module::event("comment_created", $this);
} else {
module::event("comment_updated", $this->original(), $this);
module::event("comment_updated", $original, $this);
}
// We only notify on the related items if we're making a visible change.