A data object with support for annotated magic methods.
Protected Properties | |
readonly Api Api | $api |
array array self[] AbstractEntity[] | $data = [] |
array bool[] | $diff = [] |
const | MAP = [] |
Public Methods | |
mixed | __call (string $method, array $args) |
Magic method handler. More... | |
__construct (Api|self $caller, array $data=[]) | |
array | __serialize () |
void | __unserialize (array $data) |
bool | isDiff () |
Whether the instance has changes. More... | |
array | jsonSerialize () |
bool | offsetExists (mixed $offset) |
mixed | offsetGet (mixed $offset) |
void | offsetSet (mixed $offset, mixed $value) |
void | offsetUnset (mixed $offset) |
array | toArray (bool $diff=false) |
Dehydrated data. More... | |
Protected Methods | |
mixed | _get (string $field) |
Magic method: getField() More... | |
bool | _has (string $field) |
Magic method: hasField() More... | |
T | _hydrate (string $class, $item) |
Sub-data factory that draws from the entity pool. More... | |
bool | _is (string $field) |
Magic method: isField() More... | |
bool | _of (string $resourceSubtype) |
Magic method: ofResourceSubtypeValue() More... | |
array | _select (string|iterable $subject, callable $filter,... $args) |
Magic method: selectField(callable $filter) More... | |
$this | _set (string $field, $value) |
Magic method: setField(mixed $value) More... | |
void | _setData (array $data) |
Clears all diffs and sets all data, hydrating mapped fields. More... | |
void | _setField (string $field, $value) |
Sets a value, hydrating if mapped, and clears the diff. More... | |
|
final |
|
final |
|
final |
array | $data |
|
protected |
Magic method: getField()
string | $field |
Reimplemented in AbstractEntity.
|
finalprotected |
Magic method: hasField()
Whether a countable field has anything in it, or casts a scalar field to boolean.
string | $field |
|
finalprotected |
Sub-data factory that draws from the entity pool.
@template T of self
class-string<T> | $class | |
null | string | array | self | $item |
|
finalprotected |
Magic method: isField()
Boolean casts a scalar field.
Do not use this for countable fields, use hasField()
instead.
string | $field |
|
finalprotected |
Magic method: ofResourceSubtypeValue()
string | $resourceSubtype |
|
finalprotected |
Magic method: selectField(callable $filter)
This can also be used to select from an arbitrary iterable.
string | iterable | $subject | Iterable, or field name of iterable accessed via get<subject>() |
callable | $filter | fn( Data|AbstractEntity $object ): bool |
array | $args | Arguments for the getter, if $subject is a field name. |
|
protected |
Magic method: setField(mixed $value)
string | $field | |
mixed | $value |
Reimplemented in FieldEntry, and ExternalData.
|
protected |
Clears all diffs and sets all data, hydrating mapped fields.
array | $data |
Reimplemented in Task, Story, Project, FieldEntry, Event, Status, AbstractEntity, Section, Change, FieldSetting, and Like.
|
protected |
Sets a value, hydrating if mapped, and clears the diff.
string | $field | |
mixed | $value |
Reimplemented in FieldEntries.
|
final |
Whether the instance has changes.
|
final |
bool offsetExists | ( | mixed | $offset | ) |
mixed | $offset |
mixed offsetGet | ( | mixed | $offset | ) |
mixed | $offset |
void offsetSet | ( | mixed | $offset, |
mixed | $value | ||
) |
mixed | $offset | |
mixed | $value |
void offsetUnset | ( | mixed | $offset | ) |
mixed | $offset |
array toArray | ( | bool | $diff = false | ) |