Add database and ORM scaffolding

This commit is contained in:
Alex Cabal 2021-12-09 13:13:16 -06:00
parent 42ba2f8680
commit 9d923605d8
8 changed files with 278 additions and 0 deletions

33
lib/PropertiesBase.php Normal file
View file

@ -0,0 +1,33 @@
<?
abstract class PropertiesBase extends OrmBase{
public function __get($var){
$function = 'Get' . $var;
if(method_exists($this, $function)){
return $this->$function();
}
elseif(substr($var, 0, 7) == 'Display'){
// If we're asked for a DisplayXXX property and the getter doesn't exist, format as escaped HTML.
if($this->$var === null){
$target = substr($var, 7, strlen($var));
$this->$var = Formatter::ToPlainText($this->$target);
}
return $this->$var;
}
else{
return $this->$var;
}
}
public function __set($var, $val){
$function = 'Set' . $var;
if(method_exists($this, $function)){
$this->$function($val);
}
else{
$this->$var = $val;
}
}
}