refactor: Замена строк на имена классов
This commit is contained in:
parent
1d22953f68
commit
82f6dd1630
4 changed files with 30 additions and 18 deletions
|
|
@ -11,21 +11,21 @@ class Factory
|
|||
public $config;
|
||||
public $user;
|
||||
|
||||
public function __construct (Database $db, Registry $config = null, User $user = null)
|
||||
public function __construct(Database $db, Registry $config = null, User $user = null)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->config = $config;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Создает модель
|
||||
* @param string $name
|
||||
* @return BaseMapper
|
||||
* @template T
|
||||
* @param class-string<T> $modelName
|
||||
* @return T
|
||||
*/
|
||||
public function getModel ($name)
|
||||
public function getModel($modelName)
|
||||
{
|
||||
$modelName = "App\\Mapper\\" . $name;
|
||||
$model = new $modelName();
|
||||
$model->db = $this->db;
|
||||
$model->factory = $this;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue