How to enable ENUMs in Symfony 2 / Doctrine
Solution 1:
For Symfony 2 projects, add this to the doctrine dbal configuration in app/config.yml
:
doctrine:
dbal:
mapping_types:
enum: string
My full doctrine config looks 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
mapping_types:
enum: string
set: string
varbinary: string
tinyblob: text
orm:
auto_generate_proxy_classes: %kernel.debug%
auto_mapping: true
Code adapted from here
Then run:
app/console doctrine:schema:update --force --dump-sql --ansi