diff options
-rw-r--r-- | core/controllers/welcome.php | 2 | ||||
-rw-r--r-- | core/models/item.php | 18 |
2 files changed, 3 insertions, 17 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index b9c3ac8e..4bc709b3 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -151,7 +151,7 @@ class Welcome_Controller extends Template_Controller { $parent = $parents[array_rand($parents)]; if (!rand(0, 10)) { $parents[] = album::create( - $parent->id, "rnd_" . rand(), "Rnd $i", "rnd $i", "random album $i", $user_id) + $parent->id, "rnd_" . rand(), "Rnd $i", "random album $i", $user_id) ->set_thumbnail(DOCROOT . "core/tests/test.jpg", 200, 150) ->save(); } else { diff --git a/core/models/item.php b/core/models/item.php index b83fe5c3..7209a46a 100644 --- a/core/models/item.php +++ b/core/models/item.php @@ -19,8 +19,7 @@ */ class Item_Model extends ORM_MPTT { protected $children = 'items'; - - private $owner = null; + protected $has_one = array('owner' => 'user'); /** * Is this item an album? @@ -169,23 +168,10 @@ class Item_Model extends ORM_MPTT { } /** - * @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 if (substr($column, -5) == "_edit") { + if (substr($column, -5) == "_edit") { $real_column = substr($column, 0, strlen($column) - 5); return "<span class=\"gInPlaceEdit gEditField-{$this->id}-{$real_column}\">" . "{$this->$real_column}</span>"; |