Ferreteria/v0.6/clade/Sys/Data/Engine/aux/ActionRq/Admin/ToSchema
Jump to navigation
Jump to search
| ||||||||||||||||||
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
$doReplaceoptional, but this is a kluge; minor refactoring needed
Code
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;
}