From 99c481897b8d1574bf984a1d5ea732fe63482fe0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 20 Dec 2008 22:49:32 +0000 Subject: Add "created" and "updated" timestamps to the items table. --- core/models/item.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'core/models') 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(); + } } -- cgit v1.2.3