Feature: #101396 - Let Extbase handle native enums
See forge#101396
Description
With PHP 8.1, native support for enums has been introduced. This is quite handy if a database field has a specific set of values which can be represented by a PHP enum.
It is now possible to use backed enums in entities like this:
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Domain\Model\Enum;
enum Level: string
{
case INFO = 'info';
case ERROR = 'error';
}
Copied!
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Domain\Model;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
class LogEntry extends AbstractEntity
{
protected Enum\Level $level;
}
Copied!
Impact
To implement enums, it is no longer necessary to extend the now deprecated TYPO3
Core class \TYPO3\
.