From b603bc56f96be11d55baf650b6c076ed752cae3d Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 11 Jun 2015 12:23:47 +0800 Subject: [PATCH] DataObjects/Core_notify.php --- DataObjects/Core_notify.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/DataObjects/Core_notify.php b/DataObjects/Core_notify.php index dfde1265..e73e61c0 100644 --- a/DataObjects/Core_notify.php +++ b/DataObjects/Core_notify.php @@ -54,12 +54,17 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject $this->person_id = is_object($set) ? $set->id : $set; return; } - + static $cache =array(); $person_table = empty($this->person_table) ? 'Person' : $this->person_table; $col = $person_table == "Person" ? 'person_id' : $person_table . '_id'; - + + if (isset($cache[$person_table .':'. $this->{$col}])) { + return $cache[$person_table .':'. $this->{$col}]; + } + $c = DB_DataObject::Factory($person_table); $c->get($this->{$col}); + $cache[$person_table .':'. $this->{$col}] = $c; return $c; } -- 2.39.2