【发布时间】:2016-12-12 14:09:06
【问题描述】:
我们有一个名为enumFooType 的枚举的列类型,我们已将其添加到\Doctrine\DBal\Types\Type::addType()。
在运行vendor/bin/doctrine-module migrations:diff 以生成将删除所述列的迁移时,抛出错误:
[Doctrine\DBAL\DBALException]
Unknown column type "enumFooType" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType().
You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap().
If this error occurs during database introspection then you might have forgot to register all database types for a Doctrine Type.
Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes().
If the type name is empty you might have a problem with the cache or forgot some mapping information.
我猜这个错误是因为数据库有一个foo_type 标记为(DC2Type:enumFooType)。
处理这些类型的删除的正确方法是什么?我的第一个想法是使用vendor/bin/doctrine-module migrations:generate 生成一个空白迁移并手动编写查询,但我想要一种更自动化的方式,如果可能的话不要手动编写任何内容。
【问题讨论】:
标签: doctrine-orm zend-framework2