Reputation: 12805
I'm used to creating the PDO object with something like this in the 4th parameter (driver options):
array(\PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES {$this->charset} COLLATE {$this->collation}")
How can I tell symfony 2 to do this? In the configuration file I can only see a 'charset' option.
I also need to create all the tables with a specific collation: utf8_unicode_ci
What can I do to have all the tables created through the command line be created with that collation instead of latin1?
Upvotes: 2
Views: 3011
Reputation: 16044
My solution was to apply the collation manually at the database level. Then all tables created in Symfony2 with the schema update command will have the correct collation.
I also added this line to my Sf2 doctrine: dbal configuration in the config.yml:
charset: utf8
Upvotes: 1
Reputation: 11
I have been facing the same problem. It seems that has to do with DBAL configuration. I have found in the PDO documentation the following under the PDO_MYSQL DSN — Connecting to MySQL databases:
charset Currently ignored.
Upvotes: 1