Skip to content


DBAL-4: missing column type "enum" #1591

doctrinebot opened this Issue · 10 comments

2 participants


Jira issue originally created by user chriswest:

The former supported column type "enum" is not defined in Doctrine\DBAL\Types\Type.

I've included a patch which enables the missing "enum" type in AnnotationDriver, SchemaTool and DBAL/Types. Currently, only the MySQL Platform is supported (others throw exceptions). Please have a look if you find this a possible solution. A new type "EnumType" has been added.

An example docblock syntax would be:

     * @Column(name="myenum", type="enum", values={"email","nickname"})
    private $myenum;

patch attached.


Comment created by romanb:

D2 has no enum type (because php has no enum type), we might need a new type class for this if necessary. Might be non-trivial.


Comment created by chriswest:

Yes, a new type class is needed. It should be possible (like in D1) to configure the list of available enum elements.

example from D1 doc:

      type: enum
      values: [php, java, python]

Would be important regarding migration issues.


Comment created by shurakai:

Roman, is your response to be considered a "we will work on this" or a "probably won't implement it". I'm asking because I was thinking whether I should get into this or not.


Comment created by @beberlei:

My take, given the flyweight architecture of our type-system this is only implementable with a specific Enum class in the userland. The only thing we could offer would be an abstract class to extend from. This would rather be a task for a Doctrine Extension in my opinion, or even a documentation/cookbook problem.


Comment created by @hobodave:

I see this as a non-issue. It belongs in an extension. ENUM is specific to MySQL, and is one of the most misused columns.


Comment created by @beberlei:

Change to minor


Comment created by @beberlei:


That is everything we can provide.


Issue was closed with resolution "Won't Fix"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.