Acts as a container for a task's custom-field values.
Field array-access is by GID (recommended) or name.
Protected Properties | |
array FieldEntry[] | $data = [] |
Field entries, keyed by GID. More... | |
array string[] | $gids = [] |
GIDs, keyed by field entry name. More... | |
array string[] | $names = [] |
Field entry names, keyed by GID. More... | |
array string[] | $types = [] |
[ entry gid => type ] More... | |
Protected Properties inherited from Data | |
readonly Api Api | $api |
array array self[] AbstractEntity[] | $data = [] |
array bool[] | $diff = [] |
const | MAP = [] |
Public Methods | |
__construct (Task $task, array $data=[]) | |
int | count () |
FieldEntry[] | getEntries () |
null FieldEntry | getEntry (string $ident) |
Generator< string, null|string > | getIterator () |
Human values, keyed by entry GID. More... | |
Task | getTask () |
array< string, null|number|string > | getValues () |
null string | offsetGet ($entryIdent) |
An entry's display-value. More... | |
void | offsetSet ($entryIdent, $value) |
Sets an entry's value. More... | |
magic FieldEntry[] | selectEntries (callable $filter) |
fn( FieldEntry $entry ): bool More... | |
array | toArray (bool $diff=false) |
Overridden to prepare entry diffs for task upsert. More... | |
Public Methods inherited from Data | |
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) |
Protected Methods | |
void | _setField (string $i, $data) |
Overridden to use $data for each FieldEntry. More... | |
Protected Methods inherited from Data | |
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... | |
|
protected |
Field entries, keyed by GID.
|
protected |
GIDs, keyed by field entry name.
|
protected |
Field entry names, keyed by GID.
|
protected |
[ entry gid => type ]
__construct | ( | Task | $task, |
array | $data = [] |
||
) |
Task | $task | |
array | $data | Enumerated FieldEntry data. |
|
protected |
Overridden to use $data for each FieldEntry.
string | $i | Field entry enumeration. This is ignored, since entries are keyed by GID. |
array | $data |
Reimplemented from Data.
|
final |
FieldEntry [] getEntries | ( | ) |
null FieldEntry getEntry | ( | string | $ident | ) |
string | $ident | GID or name |
Generator<string,null|string> getIterator | ( | ) |
Human values, keyed by entry GID.
|
final |
|
final |
An entry's display-value.
string | $entryIdent | GID or name |
null
if there is no such entry.
|
final |
Sets an entry's value.
The entry must exist.
{
string | $entryIdent | GID or name |
mixed | $value |
magic FieldEntry [] selectEntries | ( | callable | $filter | ) |
fn( FieldEntry $entry ): bool
array toArray | ( | bool | $diff = false | ) |
Overridden to prepare entry diffs for task upsert.
bool | $diff |
Reimplemented from Data.