Пример #1
0
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Пример #2
0
 function __construct($host = null, $login = null, $password = null, $db = null)
 {
     parent::__construct();
     if (is_null($host) || is_null($login) || is_null($password) || is_null($db)) {
         $config = Controller_config::getInstance();
         $mysql_config = $config->get("mysql");
         $host = $mysql_config["host"];
         $login = $mysql_config["login"];
         $password = $mysql_config["password"];
         $db = $mysql_config["database"];
     }
     $this->model = new Model_Mysql($host, $login, $password, $db);
 }