Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Activity

        Hide
        Roman S. Borschel added a comment -

        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.

        Show
        Roman S. Borschel added a comment - 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.
        Hide
        Christian Ehmig added a comment -

        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.

        Show
        Christian Ehmig added a comment - 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.
        Hide
        Christian Heinrich added a comment -

        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.

        Show
        Christian Heinrich added a comment - 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.
        Hide
        Benjamin Eberlei added a comment -

        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.

        Show
        Benjamin Eberlei added a comment - 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.
        Hide
        David Abdemoulaie added a comment -

        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.

        Show
        David Abdemoulaie added a comment - 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.
        Hide
        Benjamin Eberlei added a comment -

        Change to minor

        Show
        Benjamin Eberlei added a comment - Change to minor
        Hide
        Benjamin Eberlei added a comment -
        Show
        Benjamin Eberlei added a comment - See http://www.doctrine-project.org/docs/orm/2.0/en/cookbook/mysql-enums.html That is everything we can provide.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Christian Ehmig
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: