X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=DataObjects%2FCore_notify.php;h=e8f140a284351b3594b5acf8a0114227c3f8b09d;hb=73d58457ae7a7a0f139484eda190aec60ab7e561;hp=da8a9f01b8b9d8375bd93d12a4a1eacfbb7070aa;hpb=4560697211f133fb9157ec641bca04be2c84a734;p=Pman.Core diff --git a/DataObjects/Core_notify.php b/DataObjects/Core_notify.php index da8a9f01..e8f140a2 100644 --- a/DataObjects/Core_notify.php +++ b/DataObjects/Core_notify.php @@ -50,21 +50,28 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject function person($set = false) { + $def_pt = 'core_person'; + if ($set !== false) { $this->person_table = is_object($set) ? $set->tableName() : ''; - $col = $this->person_table == "Person" ? 'person_id' : $person_table . '_id'; + + + + $person_table = empty($this->person_table) ? $def_pt : strtolower($this->person_table); + $col = $person_table == $def_pt ? 'person_id' : $person_table . '_id'; + $this->{$col} = 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'; + $person_table = empty($this->person_table) ? $def_pt : strtolower($this->person_table); + $col = $person_table == $def_pt ? '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 = DB_DataObject::Factory($person_table == 'person' ? 'core_person' : $person_table); $c->get($this->{$col}); $cache[$person_table .':'. $this->{$col}] = $c; return $c;