简体   繁体   English

Doctrine2 Mysql字符集

[英]Doctrine2 Mysql charset

i have an doctrine2 orm and it generates my DB-Tables with another charset then my default mysql charset is. 我有一个doctrine2 orm,它用另一个字符集生成我的DB表,然后我的默认mysql字符集是。

how can i change the charset of the generated orm tables? 如何更改生成的orm表的字符集?

in the doctrine documentation they write, that it should be the same than the mysql-default. 在他们写的学说文档中,它应该与mysql-default相同。 but it isnt. 但这不是。

best regards 最好的祝福

ok, i found something like this: 好的,我发现了这样的东西:

// the connection configuration
$dbParams = array(
    'driver' => 'pdo_mysql',
    'user' => '****',
    'password' => '****',
    'dbname' => '****',
    'charset' => 'utf8',
    'driverOptions' => array(
        1002 => 'SET NAMES utf8'
    )
);

$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);

$em = EntityManager::create($dbParams, $config);

i have to try it. 我必须尝试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM