/** * 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); }
/** * @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); } }