Ejemplo n.º 1
0
 /**
  * Initialize database connection
  *
  * @return void
  */
 protected function connect()
 {
     $host = $this->config->get('database.host');
     $dbname = $this->config->get('database.dbname');
     $username = $this->config->get('database.username');
     $password = $this->config->get('database.password');
     $this->dbh = new PDO("mysql:host={$host};dbname={$dbname};charset=utf8", $username, $password);
 }
Ejemplo n.º 2
0
 /**
  * @param null|string $port
  * @param null|string $configFile
  */
 public function __construct($port = null, $configFile = null)
 {
     $this->configFilePath = $configFile;
     $this->config = new Config($this->configFilePath);
     $this->db = new DataBaseManager($this->config);
     if (!empty($this->config->get('timezone'))) {
         date_default_timezone_set($this->config->get('timezone'));
     }
     if (!is_null($port)) {
         $this->buildPort($port);
     }
 }