Update Models\Model

Now accessing the model property starting with A-Z will return the external method (Models\Method) specified in the engine configuration for current model or an exception.
This behavior is similar to ManagerModel.
This commit is contained in:
Visman 2021-03-16 12:15:54 +07:00
parent d5d271491d
commit ecb87a9696

View file

@ -129,8 +129,16 @@ class Model
&& isset($this->zAttrs[$root = \lcfirst(\substr($name, 6))])
) {
return $this->zAttrsCalc[$name] = $this->c->censorship->censor($this->zAttrs[$root]);
} else {
}
$x = \ord($name);
if ($x > 90 || $x < 65) {
return null;
} else {
$key = \str_replace(['ForkBB\\Models\\', 'ForkBB\\', '\\'], '', \get_class($this));
return $this->c->{$key . $name}->setModel($this);
}
}