Ferreteria/v0.6/clade/Sys/Data/Engine/schema/Cnx

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | Sys‎ | Data‎ | Engine
Revision as of 02:41, 26 November 2025 by Woozle (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
clade: Sys\Data\Engine\schema\Cnx
Clade Family
StandardBase Cnx (tbd)
Clade Aliases
Alias Clade
Base* [c,i] Aux\StandardBase
OpsIface Sys\Data\Engine\schema\Ops
QObj* [c,i] Data\Mem\QVar\Obj
QStr* [c,i] Data\Mem\QVar\Str
Subpages

Notes

[2025-11-24] Tentatively: This can be constructed without any input; the From* method is for a specific scenario.

Code

as of 2025-11-25:

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 -- //
}