fix Передача обьекта пользователя в модель
This commit is contained in:
parent
9f3523de6b
commit
73112f5bf0
3 changed files with 7 additions and 4 deletions
|
|
@ -153,7 +153,7 @@ class Action
|
||||||
public function getModel($name)
|
public function getModel($name)
|
||||||
{
|
{
|
||||||
if (!$this->factory) {
|
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);
|
return $this->factory->getModel($name);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class Database/*<Database_PDOStatement>*/ extends PDO
|
||||||
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('ctiso\\Database\\PDOStatement', array()));
|
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('ctiso\\Database\\PDOStatement', array()));
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepare($sql, $args = []) {
|
function prepare($sql, $args = []) {
|
||||||
$result/*: PDOStatement*/ = parent::prepare($sql, $args);
|
$result/*: PDOStatement*/ = parent::prepare($sql, $args);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,19 @@
|
||||||
|
|
||||||
namespace ctiso\Model;
|
namespace ctiso\Model;
|
||||||
use ctiso\Registry,
|
use ctiso\Registry,
|
||||||
ctiso\Database;
|
ctiso\Database,
|
||||||
|
ctiso\Role\User;
|
||||||
|
|
||||||
class Factory
|
class Factory
|
||||||
{
|
{
|
||||||
public $db;
|
public $db;
|
||||||
public $config;
|
public $config;
|
||||||
|
|
||||||
public function __construct (Database $db, Registry $config = null)
|
public function __construct (Database $db, Registry $config = null, User $user)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -27,6 +29,7 @@ class Factory
|
||||||
$model->db = $this->db;
|
$model->db = $this->db;
|
||||||
$model->factory = $this;
|
$model->factory = $this;
|
||||||
$model->config = $this->config;
|
$model->config = $this->config;
|
||||||
|
$model->user = $this->user;
|
||||||
$model->setUp();
|
$model->setUp();
|
||||||
//
|
//
|
||||||
return $model;
|
return $model;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue