Ferreteria/v0.6/clade/Sys/Data/Engine/schema/Cnx
Jump to navigation
Jump to search
| ||||||||||||||||||||
Notes
[2025-11-24] Tentatively: This can be constructed without any input; the From* method is for a specific scenario.
Code
interface iCnx extends BaseIface {
function QSName() : QStrIface;
function QOOps() : QObjIface;
function OOps() : OpsIface;
}
abstract class caCnx extends BaseClass implements iCnx {
// ++ SETUP ++ //
public static function FromOps(OpsIface $o) : iCnx {
$oThis = new static;
$oThis->QOOps()->SetIt($o);
return $oThis;
}
/* 2025-11-24 Maybe unnecessary.
public static FromName(string $sName) : iCnx {
$oThis = new static;
$oThis->QSName()->SetIt($sName);
return $oThis;
}
*/
// ++ OBJECTS ++ //
public function OOps() : OpsIface { return $this->QOOps()->GetIt(); }
public function QOOps() : QObjIface {
$qo = QObjClass::AsNew();
$os = $this->QSName(); // Schema name
$this->AmHere('Getting schema... got slug? ['.$os->HasIt().']');
if ($os->HasIt()) {
$sSch = $os->GetIt();
$qoOper = $this->QODbOper(); // creates new object if needed/possible
$this->AmHere("SCHEMA=[$sSch] Oper found? [".$qoOper->HasIt().']');
if ($qoOper->HasIt()) {
$oOper = $qoOper->GetIt();
$oSch = $oOper->GetSchema($sSch);
$qo->SetIt($oSch);
}
}
$this->AmHere('HAS SCHEMA: ['.$qo->HasIt().']');
return $qo;
}
// -- OBJECTS -- //
}