Search code examples
doctrine-ormzend-framework2

Unknown database type enum requested,Doctrine


when i want to generate Entity from data base i have this Error:

Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it

how can i resolve this issue.

Thanks in advance


Solution

  • You could try to do something like this in the onBootstrap module of your Module.php, to tell Doctrine to treat your enum like a string

    $em = $e->getApplication()->getServiceManager()->get('Doctrine\ORM\EntityManager');
    $platform = $em->getConnection()->getDatabasePlatform();
    $platform->registerDoctrineTypeMapping('enum', 'string');