When using Doctrine 2 with a MySQL Database which has tables with ENUM datatypes, you might run into the following error message:
‘Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.’
This is because Doctrine 2 doesn’t support the ENUM DataType natively as you can read here: Doctrine Cookbook.
In their Doctrine Cookbook they give a solution how you can resolve this by mapping the ENUM to a STRING datatype. But if you’re using Zend Framework 2 you’ll probably run into the same question as I have: where do I put this stuff for it to work?
This might not be the perfect solution, but it worked for me.
Adding the required code to the onBootstrap() method of the Module.php file of the “default” module did the job.
public function onBootstrap(MvcEvent $e)
$em = $e->getApplication()->getServiceManager()->get('Doctrine\ORM\EntityManager');
$platform = $em->getConnection()->getDatabasePlatform();