Lodata implements Enumeration Types (opens new window). These have an underlying integer type, and can support bitwise operations when using 'flags'.
Enumerations can be discovered directly from PHP 8.1's backed enumeration (opens new window) objects, or defined manually.
Once defined, the type can be applied to an entity type:
$type = new EntityType('person'); $type->addDeclaredProperty('socks', Lodata::getTypeDefinition('Colours'));
Lodata also supports the flags (opens new window) enumeration type, where multiple members can be selected simultaneously.
This can be defined with a hint on the
enum object, or defined manually.
With the enumeration defined as using flags, the
has (opens new window)
function can be used as a bitwise filter.