Monday, April 25, 2011

Using th native MySQL ENUM type in Symfony 1.4 and Doctrine

from: http://imanpage.com/code/using-th-native-mysql-enum-type-symfony-14-and-doctrine

To use the native MySQL ENUM type in Symfony and Doctrine you will have to update your "project/config/databases.yml" and add the "use_native_enum" directive under "attributes" i.e: 
      attributes:      
         use_native_enum: true
         use_dql_callbacks: true
         default_table_collate: utf8_general_ci
         default_table_charset: utf8

Full Version

all:
  doctrine:
    class: sfDoctrineDatabase
    param:
      dsn: 'mysql:host=localhost;dbname=mydb_prod'
      username: root
      password: 12345
      attributes:                
         use_native_enum: true
         use_dql_callbacks: true
         default_table_collate: utf8_general_ci
         default_table_charset: utf8

Thanks Iman! =)