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

This commit is contained in:
Visman 2023-11-22 13:48:33 +07:00
parent 8ec4676535
commit 7530f5fee0

View file

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