Register Doctrine2 type mapping with Symfony2

Well, few of us may have encountered such error while using Doctrine like “Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.” or in my case I was trying to use “enum” type with doctrine.

So, here is the app/config.yml hack at mapping_types:

# 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
Advertisements