How to define the use of utf-8 in Doctrine 2 in Zend Framework application.ini, when using Bisna

前端 未结 8 1712
暖寄归人
暖寄归人 2020-12-28 08:22

The following ZendCasts cast, shows a way to use doctrine 2 in a zend framework environment.
Using this configuration, how can I make the connection use a utf-8 charset

8条回答
  •  既然无缘
    2020-12-28 08:49

    I have this in my bootstrap:

        protected function _initDoctrineLibrary()
    {
        require_once('Doctrine/Doctrine.php');
        $this->getApplication()->getAutoloader()->pushAutoloader(array('Doctrine', 'autoload'),'Doctrine');
    
        $manager = Doctrine_Manager::getInstance();
        $manager->setAttribute(
            Doctrine::ATTR_MODEL_LOADING,
            Doctrine::MODEL_LOADING_CONSERVATIVE
        );
        $config = $this->getOption('doctrine');
        $conn = Doctrine_Manager::connection($config['dsn'],'doctrine');
        $conn->setAttribute(Doctrine::ATTR_USE_NATIVE_ENUM, true);
        return $conn;
    }
    

    where in the application.ini you see

    doctrine.dsn = "mysql://user:password@host/databasename"
    

    I think you can do something similar

提交回复
热议问题