westdc-core/Westdc/Db/Db.php

37 lines
690 B
PHP
Raw Normal View History

<?php
namespace Westdc\Db;
use Zend\Db\Adapter\Adapter;
2015-01-24 08:37:09 +00:00
use Zend\Config\Config as Zend_Config;
2015-01-24 08:37:09 +00:00
class Db
{
2015-01-24 08:37:09 +00:00
private static $_instance = NULL;
private function __construct(){
}
public static function getInstance(){
if (self::$_instance === NULL) {
$config_local = new Zend_Config(include "config/autoload/local.php");
self::$_instance = new Adapter(array(
'driver' => $config_local->db->driver,
'hostname' => $config_local->db->hostname,
2015-01-24 08:37:09 +00:00
'port' => $config_local->db->port,
'database' => $config_local->db->database,
'username' => $config_local->db->username,
'password' => $config_local->db->password
));
2015-01-24 08:37:09 +00:00
}
2015-01-24 08:37:09 +00:00
return self::$_instance;
2015-01-24 08:37:09 +00:00
}
}