gollumsf / doctrine-enum
An enum type for Doctrine MYSQL
v1.1.6
2022-05-19 08:38 UTC
Requires
- php: >=7.0
- doctrine/dbal: ^2|^3
- gollumsf/enum: ^2
README
An anum type for Doctrine MYSQL
Installation:
composer require gollumsf/doctrine-enum
Configuration:
doctrine: dbal: types: enum_my_type: App\Doctrine\MyTypeEnum
Usage:
namespace App\Doctrine; use GollumSF\Doctrine\EnumType; use App\Entity\MyType; class MyTypeEnum extends EnumType { public function getEnum(): string { return MyType::class; } } namespace App\Entity; use GollumSF\Enum\Enum; use Doctrine\ORM\Mapping as ORM; class MyType extends Enum { const VALUE1 = 'VALUE1'; const VALUE2 = 'VALUE2'; const VALUE3 = 'VALUE3'; } /** * @ORM\Entity() */ class Entity { /** * @ORM\Column(type="enum_my_type") * @var int */ private $enum; ///////// // ... // ///////// }