Библиотека для cis, online, cms1
This commit is contained in:
commit
3c2e614d87
269 changed files with 39854 additions and 0 deletions
30
core/mapper/factory.php
Normal file
30
core/mapper/factory.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
class ModelFactory
|
||||
{
|
||||
static $shortcut = "model";
|
||||
|
||||
public function __construct (Connection $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ñîçäàåò ìîäåëü
|
||||
* @param string $name
|
||||
* @return model
|
||||
*/
|
||||
public function getModel ($name)
|
||||
{
|
||||
require_once 'core/mapper/mapper.php'; // ????
|
||||
|
||||
require_once (Shortcut::getUrl(self::$shortcut, $name));
|
||||
$modelName = $name . "Mapper";
|
||||
$model = new $modelName();
|
||||
$model->db = $this->db;
|
||||
$model->factory = $this;
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue