Example #1
0
 public function connect(Config $config)
 {
     $this->config = $config;
     $this->connection = new \PDO("mysql:host={$config->get('host')};dbname={$config->get('name')}" . ($config->get('port') != '' ? ';port=' . $config->get('port') : ''), $config->get('user'), $config->get('pass'), [\PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'"]);
     $this->connection->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
     return $this;
 }