Skip to content

Loading…

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

Closed
doctrinebot opened this Issue · 10 comments

2 participants

@doctrinebot

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.

@doctrinebot

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.

@doctrinebot

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:

---
Test:
  columns:
    enumtest:
      type: enum
      values: [php, java, python]

Would be important regarding migration issues.

@doctrinebot

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.

@doctrinebot

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.

@doctrinebot

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.

@doctrinebot

Comment created by @beberlei:

Change to minor

@doctrinebot

Comment created by @beberlei:

See http://www.doctrine-project.org/docs/orm/2.0/en/cookbook/mysql-enums.html

That is everything we can provide.

@doctrinebot

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.