From: Alan Knowles Date: Thu, 11 Jun 2015 04:23:47 +0000 (+0800) Subject: DataObjects/Core_notify.php X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=b603bc56f96be11d55baf650b6c076ed752cae3d DataObjects/Core_notify.php --- 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; }