DataObjects/Core_notify.php
authorAlan Knowles <alan@roojs.com>
Thu, 11 Jun 2015 04:23:47 +0000 (12:23 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 11 Jun 2015 04:23:47 +0000 (12:23 +0800)
DataObjects/Core_notify.php

index dfde126..e73e61c 100644 (file)
@@ -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;
         
     }