mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 17:42:29 -04:00
Add database and ORM scaffolding
This commit is contained in:
parent
42ba2f8680
commit
9d923605d8
8 changed files with 278 additions and 0 deletions
33
lib/PropertiesBase.php
Normal file
33
lib/PropertiesBase.php
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue