Постарничность

This commit is contained in:
origami11 2017-05-04 15:51:19 +03:00
parent f30f7546d6
commit cc33b8f810
6 changed files with 98 additions and 3 deletions

33
src/Model/Factory.php Normal file
View file

@ -0,0 +1,33 @@
<?php
class Model_Factory
{
static $shortcut = "model";
public $db;
public $_registry;
public $_shortcut;
public function __construct (/*.Database.*/ $db, Settings $_registry = null)
{
$this->db = $db;
$this->_registry = $_registry;
}
/**
* Создает модель
* @param string $name
* @return model
*/
public function getModel ($name)
{
require_once (Shortcut::getUrl(self::$shortcut, strtolower($name)));
$modelName = $name . "Mapper";
$model = new $modelName();
$model->db = $this->db;
$model->factory = $this;
$model->_registry = $this->_registry;
$model->setUp();
//
return $model;
}
}