AbstractEntity
+ Inheritance diagram for AbstractEntity:

Description

An entity with an ID that can be saved, updated, and deleted.

Public Properties

const DIR = ''
 All subclasses must redeclare this to match their REST directory (without container). More...
 
const TYPE = ''
 All subclasses must redeclare this to match their types. More...
 
- Public Properties inherited from Data
const MAP = []
 
const PATCH = []
 

Public Static Methods

static null self load ($caller, string $id, array $query=[])
 
static self[] loadAll ($caller, string $path, array $query=[])
 

Public Methods

string __toString ()
 
null string getId ()
 
string[] getPoolKeys ()
 
bool hasId ()
 
$this reload ()
 Fully reloads the entity from Shopify. More...
 
- Public Methods inherited from Data
mixed __call (string $method, array $args)
 
 __construct ($caller, array $data=[])
 
string serialize ()
 Dehydrated JSON encode. More...
 
array toArray ()
 
void unserialize ($serialized)
 

Protected Methods

null AbstractEntity _container ()
 The container/owner object, if any. More...
 
mixed _get (string $field)
 Lazy-loads missing fields. More...
 
void _onDelete ()
 
void _onSave ()
 
void _reload (string $field)
 
- Protected Methods inherited from Data
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...
 

Additional Inherited Members

- Protected Properties inherited from Data
Api $api
 
Pool $pool
 

Properties

◆ DIR

const DIR = ''

All subclasses must redeclare this to match their REST directory (without container).

This is also the key used to wrap instance lists for API calls.

◆ TYPE

const TYPE = ''

All subclasses must redeclare this to match their types.

This is also the key used to wrap the instance singularly for API calls.

Methods

◆ __toString()

string __toString ( )
Returns
string

Reimplemented in Shop, and Metafield.

◆ _container()

null AbstractEntity _container ( )
protected

The container/owner object, if any.

Returns
null|AbstractEntity

Reimplemented in Variant, Transaction, Article, Address, Refund, Fulfillment, Comment, Image, Province, Metafield, and DiscountCode.

◆ _get()

mixed _get ( string  $field)
protected

Lazy-loads missing fields.

Parameters
string$field
Returns
mixed

◆ _reload()

void _reload ( string  $field)
protected
Parameters
string$field

◆ getId()

null string getId ( )
final
Returns
null|string

Reimplemented in Refund.

◆ getPoolKeys()

string [] getPoolKeys ( )
Returns
string[]

Reimplemented in Customer.

◆ hasId()

bool hasId ( )
final
Returns
bool

◆ load()

static null self load (   $caller,
string  $id,
array  $query = [] 
)
static
Parameters
Api | Data$caller
string$id
array$query
Returns
null|self

◆ loadAll()

static self [] loadAll (   $caller,
string  $path,
array  $query = [] 
)
static
Parameters
Api | Data$caller
string$path
array$query
Returns
self[]

◆ reload()

$this reload ( )

Fully reloads the entity from Shopify.

Returns
$this