Open
Description
Doctrine is using manually require_once
and if it happens Enum class to be in Entity folder - It bypasses the autoloader and __constructStatic is never called.
I don't have idea how to fix it generally. For quick fix in my code i did intermediate class.
final class EntityEnum extends NonEntityEnum
{
}
abstract class NonEntityEnum extends Enumeration
{
public static EntityEnum $value;
protected static function initializeValues(): void
{
self::$value = new EntityEnum();
}
}
so when Doctrine require_once 'EntityEnum.php';
it will lead autoloader to NonEntityEnum
and it will call the constructStatic.