diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2009-08-27 16:11:47 -0700 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2009-08-27 16:11:47 -0700 |
| commit | 74363ced870d4114e7570729636875e0258917b3 (patch) | |
| tree | 61bc27831a362994fc96ea90172d50e25d5c76cb /modules/gallery/libraries/MY_ORM.php | |
| parent | 98e9a96ba4d2419e02717369be8c0d886bc35ef7 (diff) | |
| parent | 4828db003f3ee505eb9e6d056cdb142da34b78ff (diff) | |
Merge branch 'master' of git@github.com:gallery/gallery3 into HEAD
Conflicts:
modules/slideshow/helpers/slideshow_event.php
Diffstat (limited to 'modules/gallery/libraries/MY_ORM.php')
| -rw-r--r-- | modules/gallery/libraries/MY_ORM.php | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/modules/gallery/libraries/MY_ORM.php b/modules/gallery/libraries/MY_ORM.php index 2bd9b4eb..de8adc1d 100644 --- a/modules/gallery/libraries/MY_ORM.php +++ b/modules/gallery/libraries/MY_ORM.php @@ -18,6 +18,9 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class ORM extends ORM_Core { + // Track the original value of this ORM so that we can look it up in ORM::original() + protected $original = null; + public function open_paren() { $this->db->open_paren(); return $this; @@ -29,8 +32,30 @@ class ORM extends ORM_Core { } public function save() { - model_cache::clear($this->object_name, $this->{$this->primary_key}, $this->primary_key); - return parent::save(); + model_cache::clear(); + $result = parent::save(); + $this->original = clone $this; + return $result; + } + + public function __set($column, $value) { + if (!isset($this->original)) { + $this->original = clone $this; + } + + return parent::__set($column, $value); + } + + public function __unset($column) { + if (!isset($this->original)) { + $this->original = clone $this; + } + + return parent::__unset($column); + } + + public function original() { + return $this->original; } } |
