private function __construct() { /** @var $config array */ include __DIR__ . '/../conf/config.php'; $dsn = 'mysql:host=localhost;dbname=' . $config['mysql']['database']; $username = $config['mysql']['user']; $password = $config['mysql']['password']; $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION); $pdo = new \PDO($dsn, $username, $password, $options); if (DEBUG_BAR) { $this->pdo = new TraceablePDO($pdo); Bootstrap::getInstance()->debugbar->addCollector(new PDOCollector($this->pdo)); } else { $this->pdo = new \PDO($dsn, $username, $password, $options); } $this->cache = Cache::getInstance(); }