Pārlūkot izejas kodu

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.
Visman 4 gadi atpakaļ
vecāks
revīzija
ecb87a9696
1 mainītis faili ar 9 papildinājumiem un 1 dzēšanām
  1. 9 1
      app/Models/Model.php

+ 9 - 1
app/Models/Model.php

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