has_metadata
trait has_metadata
Trait has_metadata.
Provides EAV (Entity-Attribute-Value) access methods for Domain Items.
Supports immutability via with_meta.
Magic Methods Support:
- get_
() : mixed - with_
($value) : static
Properties
| array<string,mixed> | $metadata | Expected property on the consuming class. |
Methods
Magic call handler for metadata getters and withers.
Retrieve a metadata value by key.
Check if a metadata key exists.
Get all metadata.
Return a new instance with the updated metadata (Immutable).
Return a new instance replacing all metadata.
Details
at line 46
mixed
__call(string $method, array $arguments)
Magic call handler for metadata getters and withers.
Allows accessing metadata like $item->get_price() or $item->with_price(10).
at line 79
mixed
get_meta(string $key, mixed $default = null)
Retrieve a metadata value by key.
at line 95
bool
has_meta(string $key)
Check if a metadata key exists.
at line 109
array
get_all_meta()
Get all metadata.
at line 124
has_metadata
with_meta(string $key, mixed $value)
Return a new instance with the updated metadata (Immutable).
at line 144
has_metadata
with_all_meta(array $metadata)
Return a new instance replacing all metadata.