Uploaded image for project: 'Doctrine DBAL'
  1. Doctrine DBAL
  2. DBAL-89

MySqlPlatform does not handle enum and set data types

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Platforms
    • Labels:
      None

      Description

      If you do a reverse engineer of an existing database that includes enum and set columns the reverse engineer will fail. Ideally there could be a separate Doctrine type for these fields, but at a minimum it seems they should be treated as string values. I solved my reverse engineering problem by modifying the initializeDoctrineTypeMappings in the MySqlPlatform.php file (attached):

      protected function initializeDoctrineTypeMappings()

      { $this->doctrineTypeMapping = array( 'tinyint' => 'boolean', 'smallint' => 'smallint', 'mediumint' => 'integer', 'int' => 'integer', 'integer' => 'integer', 'bigint' => 'bigint', 'tinytext' => 'text', 'mediumtext' => 'text', 'longtext' => 'text', 'text' => 'text', 'varchar' => 'string', 'string' => 'string', 'char' => 'string', 'date' => 'date', 'datetime' => 'datetime', 'timestamp' => 'datetime', 'time' => 'time', 'float' => 'float', 'double' => 'float', 'real' => 'float', 'decimal' => 'decimal', 'numeric' => 'decimal', 'year' => 'date', 'enum' => 'string', 'set' => 'string', ); }

        Issue Links

          Activity

          Hide
          beberlei Benjamin Eberlei added a comment -

          There is a method on the platform "regsiterDoctrineMappingType" that modifies this array.

          Enums and Sets cannot be generically supported by architectural choice.

          Show
          beberlei Benjamin Eberlei added a comment - There is a method on the platform "regsiterDoctrineMappingType" that modifies this array. Enums and Sets cannot be generically supported by architectural choice.
          Hide
          jreed James Reed added a comment -

          Ah, didn't know about the regsiterDoctrineMappingType. Good solution. Thanks!

          Show
          jreed James Reed added a comment - Ah, didn't know about the regsiterDoctrineMappingType. Good solution. Thanks!
          Hide
          jreed James Reed added a comment -

          Actually, after searching the code the method is "registerDoctrineTypeMapping"

          Show
          jreed James Reed added a comment - Actually, after searching the code the method is "registerDoctrineTypeMapping"

            People

            • Assignee:
              beberlei Benjamin Eberlei
              Reporter:
              jreed James Reed
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: