"Unknown database type enum requested ..."

Permalink 2 users found helpful
I have added custom tables using enum as datatype. When I clear the cache this leads to the following error message:
"Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it."

According to Doctrine the solution is to do something like this:
$plattform->registerDoctrineTypeMapping('enum', 'string');


In Concrete5 5.7 this can either be achieved by adding the type in 'initializeDoctrineTypeMappings' in
'concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php'
which is kind of ugly

I ended up adding the following to 'application/bootstrap/app.php'
Database::getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');

View Replies:
SecretsduPuits replied on at Permalink Reply
SecretsduPuits
Hi,

As I was experiencing the same problem, I followed your solution and... it works !!!! :-)

I added the script right on line 2
<?php
Database::getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');

Many thanks,

JF
simonchilton replied on at Permalink Reply
Great solution, works perfectly.

I was getting the error after clearing the cache, and this fixed it. The problem only happened after changing to host 123-reg, who use the enum type in their MySQL DBs even though it's not required in C5.

Thanks!