Add some basic validation.
This commit is contained in:
parent
80182644bc
commit
0a0fd1e8b0
4 changed files with 43 additions and 11 deletions
|
@ -56,7 +56,11 @@ abstract class BaseEntity {
|
|||
|
||||
public function __set($name,$value) {
|
||||
if (property_exists($this,$name)) {
|
||||
$this->$name = $value;
|
||||
if ($value == '') {
|
||||
$this->$name = null;
|
||||
} else {
|
||||
$this->$name = $value;
|
||||
}
|
||||
return $this;
|
||||
} else {
|
||||
throw new \Exception("Property {$name} does not Exists");
|
||||
|
|
Reference in a new issue