Bånder

HasMeta

Table of Contents

Properties

$meta  : array<string|int, mixed>
Dynamic meta properties that can be serialized

Methods

clearMeta()  : self
Clear all meta properties
getAllMeta()  : array<string|int, mixed>
Get all meta properties
getMeta()  : T|null
Get a typed meta property
getMetaAsType()  : T|null
Get a meta property with type assertion
getMetaKeys()  : array<string|int, mixed>
Get meta property names (keys)
hasAnyMeta()  : bool
Check if any meta properties exist
hasMeta()  : bool
Check if a meta property exists
removeMeta()  : self
Remove a meta property
setMeta()  : self
Set a meta property with type safety
setMultipleMeta()  : self
Set multiple meta properties at once
toArray()  : array<string|int, mixed>
Convert the model instance to an array including meta properties

Properties

$meta

Dynamic meta properties that can be serialized

protected array<string|int, mixed> $meta = []

Methods

clearMeta()

Clear all meta properties

public clearMeta() : self
Return values
self

getAllMeta()

Get all meta properties

public getAllMeta() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMeta()

Get a typed meta property

public getMeta(MetaKey|string $key[, T|null $default = null ]) : T|null
Parameters
$key : MetaKey|string

The meta property key

$default : T|null = null

Default value if key doesn't exist

Tags
template
Return values
T|null

getMetaAsType()

Get a meta property with type assertion

public getMetaAsType(MetaKey|string $key, T> $type[, T|null $default = null ]) : T|null
Parameters
$key : MetaKey|string

The meta property key

$type : T>

Expected type class

$default : T|null = null

Default value if key doesn't exist

Tags
template
Return values
T|null

getMetaKeys()

Get meta property names (keys)

public getMetaKeys() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasAnyMeta()

Check if any meta properties exist

public hasAnyMeta() : bool
Return values
bool

hasMeta()

Check if a meta property exists

public hasMeta(MetaKey|string $key) : bool
Parameters
$key : MetaKey|string

The meta property key

Return values
bool

removeMeta()

Remove a meta property

public removeMeta(MetaKey|string $key) : self
Parameters
$key : MetaKey|string

The meta property key to remove

Return values
self

setMeta()

Set a meta property with type safety

public setMeta(MetaKey|string $key, T $value) : self
Parameters
$key : MetaKey|string

The meta property key

$value : T

The meta property value

Tags
template
Return values
self

setMultipleMeta()

Set multiple meta properties at once

public setMultipleMeta(array<string|int, mixed> $meta) : self
Parameters
$meta : array<string|int, mixed>
Return values
self

toArray()

Convert the model instance to an array including meta properties

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results