Ferreteria/v0.3/class/tKeyedRow: Difference between revisions
< Ferreteria | v0.3 | class
Jump to navigation
Jump to search
m (Woozle moved page Ferreteria/v3/class/tKeyedRow to Ferreteria/v0.3/class/tKeyedRow: version renumbering) |
m (3 revisions imported: moving this project here) |
(No difference)
|
Latest revision as of 16:43, 22 May 2022
trait tKeyedRow {
protected function GetKeyName() {
$tbl = $this->GetSourceObject();
if (method_exists($tbl,'GetKeyName')) {
$sKey = $tbl->GetKeyName();
} else {
$sKey = NULL;
}
return $sKey;
}
public function GetKeyField() {
$sKey = $this->GetKeyName();
$oField = $this->GetExistingField($sKey);
return $oField;
}
public function GetKeyValue() {
$sKey = $this->GetKeyName();
if (is_null($sKey)) {
throw new exception('Ferreteria error: Could not retrieve key value because no key name is available.');
} else {
$v = $this->GetValueNz($sKey);
return $v;
}
}
public function SetKeyValue($id) {
$sKey = $this->GetSourceObject()->GetKeyName();
$this->SetValue($sKey,$id);
}
public function IsNew() {
return is_null($this->GetKeyValue());
}
}