diff options
Diffstat (limited to 'core/models')
-rw-r--r-- | core/models/item.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/core/models/item.php b/core/models/item.php index c8d8d1e2..a32becc9 100644 --- a/core/models/item.php +++ b/core/models/item.php @@ -19,7 +19,8 @@ */ class Item_Model extends ORM_MPTT { protected $children = 'items'; - protected $has_one = array('user'); + + private $owner = null; /** * Is this item an album? @@ -166,4 +167,26 @@ class Item_Model extends ORM_MPTT { } return $path; } + + /** + * @see ORM::reload + */ + function reload() { + $this->owner = null; + return parent::reload(); + } + + /** + * @see ORM::__get() + */ + public function __get($column) { + if ($column == "owner") { + if (!isset($this->owner)) { + $this->owner = ORM::factory("user", $this->owner_id); + } + return $this->owner; + } else { + return parent::__get($column); + } + } } |