summaryrefslogtreecommitdiff
path: root/modules/user/models/user.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/user/models/user.php')
-rw-r--r--modules/user/models/user.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/user/models/user.php b/modules/user/models/user.php
index 55bb3d6a..47fa7107 100644
--- a/modules/user/models/user.php
+++ b/modules/user/models/user.php
@@ -20,6 +20,7 @@
class User_Model_Core extends ORM implements User_Definition {
protected $has_and_belongs_to_many = array("groups");
protected $password_length = null;
+ protected $groups_cache = null;
public function __set($column, $value) {
switch ($column) {
@@ -43,6 +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);
}
/**
@@ -56,7 +58,10 @@ class User_Model_Core extends ORM implements User_Definition {
}
public function groups() {
- return $this->groups->find_all();
+ if (!$this->groups_cache) {
+ $this->groups_cache = $this->groups->find_all();
+ }
+ return $this->groups_cache;
}
/**
@@ -108,6 +113,7 @@ class User_Model_Core extends ORM implements User_Definition {
module::event("user_updated", $original, $this);
}
+ unset($this->groups_cache);
return $this;
}