Data
+ Inheritance diagram for Data:

Description

A data-object supporting annotated magic access.

Public Properties

const MAP = []
 
const PATCH = []
 

Protected Properties

Api $api
 
Pool $pool
 

Public Methods

mixed __call (string $method, array $args)
 
 __construct ($caller, array $data=[])
 
string serialize ()
 Dehydrated JSON encode. More...
 
array toArray ()
 
void unserialize ($serialized)
 

Protected Methods

mixed _hydrate (string $class, $item)
 A factory that also hydrates / caches entities. More...
 
array _select ($subject, callable $filter,... $args)
 Magic method: selectField(callable $filter) More...
 
$this _setData (array $data)
 Clears all diffs and sets all data, hydrating mapped fields. More...
 
$this _setField (string $field, $value)
 Sets a value, hydrating if mapped, and clears the diff. More...
 

Constructor

◆ __construct()

__construct (   $caller,
array  $data = [] 
)
Parameters
Api | Data$caller
array$data

Methods

◆ __call()

mixed __call ( string  $method,
array  $args 
)
Parameters
string$method
array$args
Returns
mixed

◆ _hydrate()

mixed _hydrate ( string  $class,
  $item 
)
protected

A factory that also hydrates / caches entities.

Parameters
string$class
mixed$item
Returns
mixed

◆ _select()

array _select (   $subject,
callable  $filter,
  $args 
)
protected

Magic method: selectField(callable $filter)

Where Field has an accessor at getField(), either real or magic.

This can also be used to select from an arbitrary iterable.

See also
__call()
Parameters
string | iterable$subject
callable$filterfn( Data $object ): bool
array$args
Returns
array

◆ _setData()

$this _setData ( array  $data)
protected

Clears all diffs and sets all data, hydrating mapped fields.

Parameters
array$data
Returns
$this

Reimplemented in Customer, and AbandonedCheckout.

◆ _setField()

$this _setField ( string  $field,
  $value 
)
protected

Sets a value, hydrating if mapped, and clears the diff.

Parameters
string$field
mixed$value
Returns
$this

◆ serialize()

string serialize ( )

Dehydrated JSON encode.

Returns
string

◆ toArray()

array toArray ( )
Returns
array

◆ unserialize()

void unserialize (   $serialized)
Parameters
$serialized