解决 ZendFramework2 Doctrine 出现 MySql 不支持 enum 类型问题的方法

最近项目用 zendFramework 2 + Doctrine,composer 安装完毕后使用 vendor/bin/doctrine-module orm:validate-schema
命令出现以下错误:

  [DoctrineDBALDBALException]
  Unknown database type enum requested, DoctrineDBALPlatformsMySqlPlatform may not support i
  t.

网上找了很多都是解决在 Symfony 下的,没有发现在 zf2下如何解决,红杏(fanqiang)后终于找到一老外找到了解决办法:
在 Application 模块(默认模块)的 Module.php 文件添加以下内容:

class Module {
        public function onBootstrap(MvcEvent $e) {

......

        $em = $e->getApplication()->getServiceManager()->get('DoctrineORMEntityManager');
        $dbPlatform = $em->getConnection()->getDatabasePlatform();
        $dbPlatform->registerDoctrineTypeMapping('enum', 'string');


.....

}
}

原帖地址:http://foobar.lu/wp/2013/01/24/getting-enum-datatype-to-work-with-doctrine-2-in-zend-framework-2/