summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-01-18 12:08:39 -0800
committerBharat Mediratta <bharat@menalto.com>2010-01-18 12:08:39 -0800
commit284788d964688385f77b18bc063a841d0dbcdcd8 (patch)
treea406c7211a1612fba1be2ef006c92b599705fd9a /modules/gallery/helpers
parent41a392611c0e602d2e14859e5c0d5bf9e61d0073 (diff)
Switch from stdClass to arrays which works around issues caused in
http://dev.kohanaphp.com/issues/2459 -- I don't exactly know why, but the solutions are equivalent so I'm not going to dig too far.
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/model_cache.php14
1 files changed, 6 insertions, 8 deletions
diff --git a/modules/gallery/helpers/model_cache.php b/modules/gallery/helpers/model_cache.php
index 302e42d9..88756407 100644
--- a/modules/gallery/helpers/model_cache.php
+++ b/modules/gallery/helpers/model_cache.php
@@ -18,27 +18,25 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class model_cache_Core {
- private static $cache;
+ private static $cache = array();
static function get($model_name, $id, $field_name="id") {
- if (TEST_MODE || empty(self::$cache->$model_name->$field_name->$id)) {
+ if (TEST_MODE || empty(self::$cache[$model_name][$field_name][$id])) {
$model = ORM::factory($model_name)->where($field_name, "=", $id)->find();
if (!$model->loaded()) {
throw new Exception("@todo MISSING_MODEL $model_name:$id");
}
- self::$cache->$model_name->$field_name->$id = $model;
+ self::$cache[$model_name][$field_name][$id] = $model;
}
- return self::$cache->$model_name->$field_name->$id;
+ return self::$cache[$model_name][$field_name][$id];
}
static function clear() {
- self::$cache = new stdClass();
+ self::$cache = array();
}
static function set($model) {
- self::$cache->{$model->object_name}
- ->{$model->primary_key}
- ->{$model->{$model->primary_key}} = $model;
+ self::$cache[$model->object_name][$model->primary_key][$model->{$model->primary_key}] = $model;
}
}