fix Передача обьекта пользователя в модель

This commit is contained in:
origami11@yandex.ru 2022-12-09 17:39:23 +03:00
parent 9f3523de6b
commit 73112f5bf0
3 changed files with 7 additions and 4 deletions

View file

@ -153,7 +153,7 @@ class Action
public function getModel($name)
{
if (!$this->factory) {
$this->factory = new Factory($this->db, $this->config);
$this->factory = new Factory($this->db, $this->config, $this->user);
}
return $this->factory->getModel($name);
}

View file

@ -2,17 +2,19 @@
namespace ctiso\Model;
use ctiso\Registry,
ctiso\Database;
ctiso\Database,
ctiso\Role\User;
class Factory
{
public $db;
public $config;
public function __construct (Database $db, Registry $config = null)
public function __construct (Database $db, Registry $config = null, User $user)
{
$this->db = $db;
$this->config = $config;
$this->user = $user;
}
/**
@ -27,6 +29,7 @@ class Factory
$model->db = $this->db;
$model->factory = $this;
$model->config = $this->config;
$model->user = $this->user;
$model->setUp();
//
return $model;