DBAL-232: Custom commented column type removal causes unknown column type exception #1408

doctrinebot opened this Issue Mar 6, 2012 · 5 comments

2 participants


Jira issue originally created by user gedrox:

Problem happens when initially, as example, there was commented type "foo" registered and used:

Doctrine\DBAL\Types\Type::addType('foo', 'FooType');

When the type usage and declaration is removed, the database schema upgrade fails.
This is because DBAL reads the comment from the database and tries to find the type 'foo'.

I suggest ignoring the database column comment and stick to the standard type recognition in case the type is not declared.


Comment created by gedrox:

Trivial solution would be:

--- a/Doctrine/DBAL/Schema/AbstractSchemaManager.php
<ins></ins><ins> b/Doctrine/DBAL/Schema/AbstractSchemaManager.php
@@ -878,7 </ins>878,9 @@ abstract class AbstractSchemaManager
     public function extractDoctrineTypeFromComment($comment, $currentType)
         if (preg_match("(\(DC2Type:([a-zA-Z0-9]<ins>)\))", $comment, $match)) {
-            $currentType = $match[1];
</ins>                       if (Types\Type::hasType($match[1])) {
<ins>                               $currentType = $match[1];
</ins>                       }
         return $currentType;

Comment created by @deeky666:

Proposed solution applied in PR:



Comment created by @doctrinebot:

A related Github Pull-Request [GH-406] was closed:


Comment created by @deeky666:

As discussed with ocramius, it is not a good solution to silence this error during schema introspection. The problem has to be fixed by registering the missing types in the application or modifying the database schema manually by removing the column comment. This is what the current exception message suggest anyways.


Issue was closed with resolution "Won't Fix"

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment