doctrine 报错处理办法: Unknown database type enum requested

php app/console doctrine:schema:update --force

在sf2update schema的时候 会出现一种报错 数据库不支持枚举类型

D:\htdocs\Symfony>php app/console doctrine:schema:update --force

  [Doctrine\DBAL\DBALException]
  Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.


解决办法

symfony2\app\config\config.yml修改一下

doctrine:
    dbal:
        driver:   %database_driver%
        host:     %database_host%
        port:     %database_port%
        dbname:   %database_name%
        user:     %database_user%
        password: %database_password%
        charset:  UTF8
        # if using pdo_sqlite as your database driver, add the path in parameters.yml
        # e.g. database_path: %kernel.root_dir%/data/data.db3
        # path:     %database_path%
    orm:
        auto_generate_proxy_classes: %kernel.debug%
        auto_mapping: true

修改成

doctrine:
    dbal:
        driver:   %database_driver%
        host:     %database_host%
        port:     %database_port%
        dbname:   %database_name%
        user:     %database_user%
        password: %database_password%
        charset:  UTF8
        # if using pdo_sqlite as your database driver, add the path in parameters.yml
        # e.g. database_path: %kernel.root_dir%/data/data.db3
        # path:     %database_path%
        mapping_types:
            enum: string
            set: string
            varbinary: string
            tinyblob: text
    orm:
        auto_generate_proxy_classes: %kernel.debug%
        auto_mapping: true

把不支持的几个类型 enum,set等等换成 mysql常用的基本类型 就好了

你可能感兴趣的:(symfony2,Doctrine)