Doctrine 2.1 and tables utf-8 coding

Could someone tell me how to force Doctrine to create database tables with UTF-8 coding and utf8_polish_ci? My Doctrine config file has this db configuration parameters:

$conn = array(
    'driver' => 'pdo_mysql',
    'dbname' => 'test',
    'user' => 'root',
    'password' => '*****',
    'charset' => 'utf8',
    'driverOptions' => array(1002=>'SET NAMES utf8'));

Nevertheless, it's still creating table with default coding: latin1 and latin1_swedish_ci.

Answers


You set it in your database, doctrine just uses the databases default values. See this question from the 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.


Need Your Help

data.table group by with a filter condition

r data.table

Given a data.table like the one below, I would like to create a new column which is the value summed by region, and where period == 0.

one class CRF source code for outlier detection - C++

c++ machine-learning computer-vision outliers causality

Can anyone suggest me a C++ library for one class conditional random field? which can be used for abnormality detection.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.