Use PHP Enums as Doctrine type in Symfony

Smaine Milianni
2 min readDec 29, 2021
credit: sensiolabs tweet

PHP 8.1 adds support for Enumerations. An Enumeration, is an enumerated type that has a fixed number of possible values. (see more details)

✍🏻 In this article, I’ll show you how to use an Enum as a doctrine WITHOUT adding configuration.

First, what is a doctrine type?

Smaine Milianni

Fullstack Developer- certified Symfony 4,5 and certified AWS Solution Architect - Freelancer - Remote Worker