Ferreteria/v0.6/clade/Sys/Data/Engine/aux/ActionRq/Admin/ToSchema

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | Sys‎ | Data‎ | Engine‎ | aux‎ | ActionRq‎ | Admin
Jump to navigation Jump to search
clade: Sys\Data\Engine\aux\ActionRq\Admin\ToSchema
Clade Family
Admin ToSchema EngDbExport
Clade Aliases
Alias Clade
Base* [ca,i,t] Sys\Data\Engine\aux\ActionRq\Admin
DataNode* [c,i] Sys\FileSys\Node\Fi
Schema* [i] Sys\Data\Engine\Schema
Subpages

About

  • Purpose: base type for Requests that need a Schema (which includes a DbConn)
  • Parallel: ToDbConn
  • Usage:
    • Anything which uses this trait/iface also needs the ToDbConn trait/iface. (...I think. 2025-11-10)

History

  • 2025-03-25 created
  • 2025-10-06 made $doReplace optional, but this is a kluge; minor refactoring needed

Code

as of 2025-11-10

interface iToSchema extends BaseIface {
    static function FromParams(SchemaIface $o,DataNodeIface $of,?bool $doReplace=FALSE) : self;
}
trait tToSchema {
    use BaseTrait;

    // ++ SETUP ++ //

    public static function FromParams(SchemaIface $o,DataNodeIface $of,?bool $doReplace=FALSE) : iToSchema {
        $oThis = new static;
        $oThis->WithParams($o,$of,$doReplace);
        return $oThis;
    }

    // ++ SETUP: dynamic ++ //

    private $ofData;
    private $doRepl;
    protected function WithParams(SchemaIface $o, DataNodeIface $of, bool $doReplace) {
        $this->QOSchema()->SetIt($o);
        $this->ofData = $of;
        $this->doRepl = $doReplace;
    }
    protected function DataFileNode() : DataNodeIface { return $this->ofData; }
    protected function OkToReplace() : bool { return $this->doRepl; }

    // -- SETUP -- //
}
abstract class caToSchema extends BaseClass implements iToSchema {
    use tToSchema;
}