When running doctrine:mapping:import
i get an error:
Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.
It seems I need to set use_native_enum
to true
some how. However, all documentation and blog posts are refering to Symfony < 1.4. Is there any what would be the solution in Symfony 2?
Considering the Doctrine cookbook only provides partial answers as to how to make enums interpret as strings, the following should work regardless of how Doctrine is configured.
The error points you at the name of the file:
Doctrine\DBAL\Platforms\MySqlPlatform
.php - in there, you'll find that the default list is embedded in the functioninitializeDoctrineTypeMappings
as follows:Adding simple enum support for all doctrine users, regardless of the rest of the setup, is simply achieved by extending the list with:
For Symfony 2 projects, add this to the doctrine dbal configuration in
app/config.yml
:My full doctrine config looks like this:
Code adapted from here
Then run:
app/console doctrine:schema:update --force --dump-sql --ansi