I am using Doctrine with Symfony2.
My config.yml file looks something like this:-
Doctrine Configuration
doctrine:
dbal:
driver: %database_driver%
host: %database_host%
port: %database_port%
dbname: %database_name%
user: %database_user%
password: %database_password%
charset: UTF8
Unfortunately my tables are not collating to the UTF8_general_ci or UTF8_unicode_ci
I tried
collate: utf8_unicode_ci
But Doctrine2 didn’t recognize the option.
How can I achieve the same?
The
charset: UTF8option is just useful to ask Doctrine to executeSET NAMES UTF-8on each page. I don’t have any specific configuration for Doctrine, and my tables are by default inutf8_general_ciInnoDB.Read this part of the documentation: https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/faq.html#how-do-i-set-the-charset-and-collation-for-mysql-tables, it answers your question: