Follow on to 1057436b7c -- cache the

users and groups as an array so that multiple calls will not call
ORM_Iterator->current() repeatedly.
This commit is contained in:
Bharat Mediratta
2010-12-15 19:57:09 -08:00
parent 1057436b7c
commit 8a5bbc896b
2 changed files with 6 additions and 6 deletions

View File

@@ -29,12 +29,12 @@ class Group_Model_Core extends ORM implements Group_Definition {
module::event("group_before_delete", $this);
parent::delete($id);
module::event("group_deleted", $old);
unset($this->users_cache);
$this->users_cache = null;
}
public function users() {
if (!$this->users_cache) {
$this->users_cache = $this->users->find_all();
$this->users_cache = $this->users->find_all()->as_array();
}
return $this->users_cache;
}
@@ -65,7 +65,7 @@ class Group_Model_Core extends ORM implements Group_Definition {
module::event("group_updated", $original, $this);
}
unset($this->users_cache);
$this->users_cache = null;
return $this;
}