|
|
@@ -40,7 +40,14 @@ abstract class Entity {
|
|
|
}
|
|
|
$this->$property = $value;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ public function __get($key){
|
|
|
+ if(!isset($this->$key)){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return $this->toArray()[$key];
|
|
|
+ }
|
|
|
+
|
|
|
public function __toString() {
|
|
|
if (isset($this->name)) {
|
|
|
return $this->name;
|
|
|
@@ -333,7 +340,9 @@ abstract class Entity {
|
|
|
$objects[] = $object;
|
|
|
}
|
|
|
if (empty($objects)) {
|
|
|
- return false; //new $this->classname;
|
|
|
+ //return false; //new $this->classname;
|
|
|
+ $className = static::class;
|
|
|
+ return new $className;
|
|
|
}
|
|
|
return $objects[0];
|
|
|
}
|