瀏覽代碼

Models\Model.: Add setManager() method to pass the current Manager to the model

Visman 1 年之前
父節點
當前提交
7530f5fee0
共有 1 個文件被更改,包括 16 次插入0 次删除
  1. 16 0
      app/Models/Model.php

+ 16 - 0
app/Models/Model.php

@@ -11,6 +11,7 @@ declare(strict_types=1);
 namespace ForkBB\Models;
 
 use ForkBB\Core\Container;
+use ForkBB\Models\Manager;
 
 class Model
 {
@@ -34,6 +35,11 @@ class Model
      */
     protected array $zDepend = [];
 
+    /**
+     * Текущий Manager для модели
+     */
+    protected Manager $manager;
+
     public function __construct(protected Container $c)
     {
     }
@@ -165,4 +171,14 @@ class Model
 
         return $this->c->$key->setModel($this)->$name(...$args);
     }
+
+    /**
+     * Объявление менеджера
+     */
+    public function setManager(Manager $manager): Model
+    {
+        $this->manager = $manager;
+
+        return $this;
+    }
 }