summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/libraries/MY_ORM.php12
-rw-r--r--modules/gallery/models/item.php2
-rw-r--r--modules/gallery/tests/Item_Model_Test.php2
3 files changed, 8 insertions, 8 deletions
diff --git a/modules/gallery/libraries/MY_ORM.php b/modules/gallery/libraries/MY_ORM.php
index 1d3c1ef3..de8adc1d 100644
--- a/modules/gallery/libraries/MY_ORM.php
+++ b/modules/gallery/libraries/MY_ORM.php
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class ORM extends ORM_Core {
- // Track the original value of this ORM instance so that we can look it up in ORM::original()
+ // Track the original value of this ORM so that we can look it up in ORM::original()
protected $original = null;
public function open_paren() {
@@ -34,13 +34,13 @@ class ORM extends ORM_Core {
public function save() {
model_cache::clear();
$result = parent::save();
- $this->original = $this->object;
+ $this->original = clone $this;
return $result;
}
public function __set($column, $value) {
if (!isset($this->original)) {
- $this->original = $this->object;
+ $this->original = clone $this;
}
return parent::__set($column, $value);
@@ -48,14 +48,14 @@ class ORM extends ORM_Core {
public function __unset($column) {
if (!isset($this->original)) {
- $this->original = $this->object;
+ $this->original = clone $this;
}
return parent::__unset($column);
}
- public function original($column) {
- return $this->original[$column];
+ public function original() {
+ return $this->original;
}
}
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index b3c7998b..f3e6b8f3 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -365,7 +365,7 @@ class Item_Model extends ORM_MPTT {
}
parent::save();
if (isset($send_event)) {
- module::event("item_updated", $this);
+ module::event("item_updated", $this->original(), $this);
}
return $this;
}
diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php
index c2773097..0940d076 100644
--- a/modules/gallery/tests/Item_Model_Test.php
+++ b/modules/gallery/tests/Item_Model_Test.php
@@ -147,7 +147,7 @@ class Item_Model_Test extends Unit_Test_Case {
$item->save();
$item->title = "NEW_VALUE";
- $this->assert_same("ORIGINAL_VALUE", $item->original("title"));
+ $this->assert_same("ORIGINAL_VALUE", $item->original()->title);
$this->assert_same("NEW_VALUE", $item->title);
}
}