Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

When running doctrine:mapping:import i get an error:

Unknown database type enum requested, DoctrineDBALPlatformsMySqlPlatform may not support it.

It seems I need to set use_native_enum to true some how. However, all documentation and blog posts are refering to Symfony < 1.4. Is there any what would be the solution in Symfony 2?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
273 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...