/** * binds an array/hash to this object * @param int $oid optional argument, if not specifed then the value of current key is used * @return any result from the database operation */ function load($oid = null) { $k = $this->_tbl_key; if ($oid !== null) { $this->{$k} = $oid; } $oid = $this->{$k}; if ($oid === null) { return false; } //BB fix : resets default values to all object variables, because NULL SQL fields do not overide existing variables ! //Note: Prior to PHP 4.2.0, Uninitialized class variables will not be reported by get_class_vars(). $class_vars = get_class_vars(get_class($this)); foreach ($class_vars as $name => $value) { if ($name != $k and $name != "_db" and $name != "_tbl" and $name != "_tbl_key") { $this->{$name} = $value; } } //end of BB fix. return parent::load($oid); }
function load($cid = 0) { if ($cid == 0) { // Only read if recID passed return $this->init_record(); } else { // fill in some 'null' fields return parent::load($cid); } }