有人能告诉我如何强制Doctrine使用UTF-8编码和utf8_polish_ci创建数据库表吗?我的Doctrine配置文件有这个db配置参数:
$conn = array( 'driver' => 'pdo_MysqL','dbname' => 'test','user' => 'root','password' => '*****','charset' => 'utf8','driverOptions' => array(1002=>'SET NAMES utf8'));
尽管如此,它仍然使用默认编码创建表:latin1和latin1_swedish_ci.
您在数据库中设置它,doctrine只使用数据库默认值.请参阅
Doctrine 2.1 FAQ:中的这个问题
4.1.1. How do I set the charset and collation for MysqL tables?
You can’t set these values inside the annotations,yml or xml mapping files. To make a database work with the default charset and collation you should configure MysqL to use it as default charset,or create the database with charset and collation details. This way they get inherited to all newly created database tables and columns.