Skip to content


DBAL-89: MySqlPlatform does not handle enum and set data types #2130

doctrinebot opened this Issue · 6 comments

2 participants


Jira issue originally created by user jreed:

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',

Comment created by @beberlei:

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

Enums and Sets cannot be generically supported by architectural choice.


Issue was closed with resolution "Won't Fix"


Comment created by jreed:

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


Comment created by jreed:

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

@doctrinebot doctrinebot added the Bug label
@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.