diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2008-12-20 22:49:32 +0000 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-20 22:49:32 +0000 |
| commit | 99c481897b8d1574bf984a1d5ea732fe63482fe0 (patch) | |
| tree | 00bfc1fd883d234292292ff6cc788e5c9564fed9 /core/models/item.php | |
| parent | 05f26fa2d4d45d99082c81f03fa71922770d18dc (diff) | |
Add "created" and "updated" timestamps to the items table.
Diffstat (limited to 'core/models/item.php')
| -rw-r--r-- | core/models/item.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/models/item.php b/core/models/item.php index e5eb4039..d71414d8 100644 --- a/core/models/item.php +++ b/core/models/item.php @@ -237,4 +237,17 @@ class Item_Model extends ORM_MPTT { return parent::__get($column); } } + + /** + * @see ORM::save() + */ + public function save() { + if (!empty($this->changed) && $this->changed != array("view_count" => "view_count")) { + $this->updated = time(); + if (!$this->loaded) { + $this->created = $this->updated; + } + } + return parent::save(); + } } |
