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

Works fine for me resources.doctrine.dbal.connections.defa...eters.driverOptions.1002 = "SET NAMES 'UTF8.

If you are not using bisna you could simply do something like this: pass the config stuff directly to EntityManager's connection options (however driverOptions is not documented) //$options is a simple array to hold your data $connectionOptions = array( 'driver' => $options'conn''driv', 'user' => $options'conn''user', 'password' => $options'conn''pass', 'dbname' => $options'conn''dbname', 'host' => $options'conn''host', 'charset' => 'utf8', 'driverOptions' => array( 1002=>'SET NAMES utf8' ) ); $em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config); I'm using a custom bootstrap resource to initialize doctrine therefore $options is in application. Ini and is easily accessible here with $this->getOptions(); // \library\My\Application\Resource\Doctrine. Php class My_Application_Resource_Doctrine extends Zend_Application_Resource_ResourceAbstract { public function init() { $options = $this->getOptions(); $config = new \Doctrine\ORM\Configuration(); //doctrine autoloader, config and other initializations ... $connectionOptions = array( .... //see above ); $em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config); $registry = Zend_Registry::getInstance(); $registry->em = $em; return $em; } } It will bootstrap automatically if you put in application.

Ini resources.doctrine.conn. Host = '127.0.0.1' resources.doctrine.conn. User = '...' resources.doctrine.conn.

Pass = '...' ....

It is possible to add it via application. Ini, provided you use ZendX_Doctrine2 (at https://github. Com/mridgway/ZendX_Doctrine2) with MySQL.

Then here's the line you need in application. Ini: resources. Entitymanagerfactory.

ConnectionOptions.driverOptions.1002 = "SET NAMES utf8" (1002 == PDO::MYSQL_ATTR_INIT_COMMAND) Don't forget to correctly set default-character-set=utf8 in your my.cnf.

Since this is for Doctrine 2, and ZendCasts is using Bisna, I believe you can just add this to your configuration. Ini file resources.doctrine.dbal.connections.defa...eters.driverOptions. Charset = "utf8" I'm not exactly sure how to test if it is sticking or not but let us know.

You are correct regarding the use of Bisna, and the line you gave does have it's affect. However - according to doctrine-project. Org/docs/dbal/2.0/en/reference/events.

Html, there's a post connect event to which I need to subscribe a MysqlSessionInit object with the utf-8 charset. Any idea? – Doron Mar 22 at 20:30.

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.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions