summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-12-15 19:57:09 -0800
committerBharat Mediratta <bharat@menalto.com>2010-12-15 19:57:09 -0800
commit8a5bbc896b2b281039a5e34a5fc330b826825dd2 (patch)
treeac7c0eccae1dfdc8e5016147c52ec2004af450c3 /modules
parent1057436b7c483c60b3c128fab993a3b78fac7093 (diff)
Follow on to 1057436b7c483c60b3c128fab993a3b78fac7093 -- cache the
users and groups as an array so that multiple calls will not call ORM_Iterator->current() repeatedly.
Diffstat (limited to 'modules')
-rw-r--r--modules/user/models/group.php6
-rw-r--r--modules/user/models/user.php6
2 files changed, 6 insertions, 6 deletions
diff --git a/modules/user/models/group.php b/modules/user/models/group.php
index 66c9aafc..8f8e218d 100644
--- a/modules/user/models/group.php
+++ b/modules/user/models/group.php
@@ -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;
}
diff --git a/modules/user/models/user.php b/modules/user/models/user.php
index 47fa7107..585f4b96 100644
--- a/modules/user/models/user.php
+++ b/modules/user/models/user.php
@@ -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;
}