34 lines
669 B
PHP
34 lines
669 B
PHP
|
<?php
|
||
|
/**
|
||
|
* Created by PhpStorm.
|
||
|
* User: Administrator
|
||
|
* Date: 2014/12/4
|
||
|
* Time: 11:28
|
||
|
*/
|
||
|
|
||
|
namespace Westdc\Visual;
|
||
|
|
||
|
|
||
|
class Database {
|
||
|
|
||
|
public $db;
|
||
|
|
||
|
function __construct()
|
||
|
{
|
||
|
$this->initDatabase();
|
||
|
}
|
||
|
|
||
|
public function initDatabase()
|
||
|
{
|
||
|
$config = \Zend_Registry::get('config');
|
||
|
|
||
|
$dsn = "pgsql:host={$config->visual_db->hostname};"
|
||
|
."port={$config->visual_db->port};"
|
||
|
."dbname={$config->visual_db->database};"
|
||
|
."user={$config->visual_db->username};"
|
||
|
."password={$config->visual_db->password}";
|
||
|
|
||
|
$this->db = new \PDO($dsn);
|
||
|
}
|
||
|
|
||
|
}
|