Fix Model and Manager

This commit is contained in:
Visman 2021-12-03 15:57:01 +07:00
parent a3a555a116
commit f165e9fc00
2 changed files with 13 additions and 5 deletions

View file

@ -58,9 +58,15 @@ class Manager
*/
public function __get(string $name) /* : mixed */
{
$key = $this->cKey . '/' . $name;
$x = \ord($name);
return $this->c->$key->setManager($this);
if ($x > 90 || $x < 65) {
return null;
} else {
$key = $this->cKey . '/' . \lcfirst($name);
return $this->c->$key->setManager($this);
}
}
/**
@ -68,6 +74,8 @@ class Manager
*/
public function __call(string $name, array $args) /* : mixed */
{
return $this->__get($name)->$name(...$args);
$key = $this->cKey . '/' . $name;
return $this->c->$key->setManager($this)->$name(...$args);
}
}

View file

@ -143,9 +143,9 @@ class Model
if ($x > 90 || $x < 65) {
return null;
} else {
$key = \str_replace(['ForkBB\\Models\\', 'ForkBB\\', '\\'], '', \get_class($this));
$key = $this->cKey . '/' . \lcfirst($name);
return $this->c->{$key . $name}->setModel($this);
return $this->c->$key->setModel($this);
}
}