Ferreteria/v0.6/clade/Sys/Data/Engine/schema/Cnx: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{page/clade/v2 |fam= {{!}} align=right {{!}} {{l/ver/clade|Aux|StandardBase}} {{!}} align=center {{!}} {{l/ver/clade|Sys\Data\Engine\schema|Cnx}} {{!}} align=left {{!}} ''(tbd)'' |alia= {{!-!}} '''Base'''* [c,i] {{!!}} {{l/ver/clade/full|Aux|StandardBase}} {{!-!}} '''OpsIface''' {{!!}} {{l/ver/clade/full|Sys\Data\Engine\schema|Ops}} {{!-!}} '''QObj'''* [c,i] {{!!}} {{l/ver/clade/full|Data\Mem\QVar|Obj}} {{!-!}} '''QStr'''* [c,i] {{!!}} {{l/ver/clade/full|Data\Mem...") |
No edit summary |
||
| Line 2: | Line 2: | ||
|fam= | |fam= | ||
{{!}} align=right {{!}} {{l/ver/clade|Aux|StandardBase}} | {{!}} align=right {{!}} {{l/ver/clade|Aux|StandardBase}} | ||
{{!}} align=center {{!}} {{l/ver/clade|Sys\Data\Engine\schema|Cnx}} | {{!}} align=center {{!}} ⇒ {{l/ver/clade|Sys\Data\Engine\schema|Cnx}} ⇒ | ||
{{!}} align=left {{!}} ''(tbd)'' | {{!}} align=left {{!}} ''(tbd)'' | ||
| Line 14: | Line 14: | ||
==Notes== | ==Notes== | ||
['''{{fmt/date|2025|11|24}}'''] Tentatively: This ''can'' be constructed without any input; the <code>{{l/ver/fx|From*}}</code> method is for a specific scenario. | ['''{{fmt/date|2025|11|24}}'''] Tentatively: This ''can'' be constructed without any input; the <code>{{l/ver/fx|From*}}</code> method is for a specific scenario. | ||
==Code== | |||
''as of {{fmt/date|2025|11|25}}:'' | |||
{{fmt/php/block|1= | |||
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 -- // | |||
} | |||
}} | |||
Latest revision as of 02:41, 26 November 2025
| ||||||||||||||||||||
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 -- //
}