mruz / base-app

The base application in PhalconPHP
63 stars 19 forks source link

UTF-8 support in DB connection #18

Closed far4599 closed 10 years ago

far4599 commented 10 years ago

Please add utf-8 to db connection in bootstrap.php

protected function db()
    {
        $config = $this->_config;
        $this->_di->set('db', function() use ($config) {
            return new \Phalcon\Db\Adapter\Pdo\Mysql(array(
                "host" => $config->database->host,
                "username" => $config->database->username,
                "password" => $config->database->password,
                "dbname" => $config->database->dbname,
                "options" => array(
                    \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
                )
            ));
        });
    }
mruz commented 10 years ago

Added in the branch 2.0