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

@@ -44,7 +44,7 @@ class User_Model_Core extends ORM implements User_Definition {
module::event("user_before_delete", $this);
parent::delete($id);
module::event("user_deleted", $old);
unset($this->groups_cache);
$this->groups_cache = null;
}
/**
@@ -59,7 +59,7 @@ class User_Model_Core extends ORM implements User_Definition {
public function groups() {
if (!$this->groups_cache) {
$this->groups_cache = $this->groups->find_all();
$this->groups_cache = $this->groups->find_all()->as_array();
}
return $this->groups_cache;
}
@@ -113,7 +113,7 @@ class User_Model_Core extends ORM implements User_Definition {
module::event("user_updated", $original, $this);
}
unset($this->groups_cache);
$this->groups_cache = null;
return $this;
}