Reputation: 83
I'm getting the following error while running,
php bin/console doctrine:schema:validate
[Mapping] OK - The mapping files are correct.
[Doctrine\DBAL\DBALException]
Unknown database type enum requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it.
doctrine:schema:validate [--skip-mapping] [--skip-sync] [--em [EM]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>.
Upvotes: 3
Views: 4931
Reputation: 660
You need to add mapping_types
in your configuration:
#config/packages/doctrine.yaml doctrine
dbal:
types:
myenum: App\DBAL\MyEnumType
mapping_types:
enum: string # <- this is what you need!
and in your entity class:
class Page {
...
/**
* @ORM\Column(type="myenum")
*/
protected $type;
...
}
Link to documentation how to prepare your own Mapping Type doctrine2-mapping-types
Upvotes: 4