Override method getDefaultValue
in your ENUM class:
<?php
namespace App\DBAL\Types;
use Fresh\DoctrineEnumBundle\DBAL\Types\AbstractEnumType;
/**
* @extends AbstractEnumType<string, string>
*/
final class MapLocationType extends AbstractEnumType
{
public final const NORTH = 'N';
public final const EAST = 'E';
public final const SOUTH = 'S';
public final const WEST = 'W';
public final const CENTER = 'C';
protected static array $choices = [
self::NORTH => 'North',
self::EAST => 'East',
self::SOUTH => 'South',
self::WEST => 'West',
self::CENTER => 'Center',
];
public static function getDefaultValue(): ?string
{
return self::CENTER; // This value will be used as default in DDL statement
}
}