Property | Type | Description | |
---|---|---|---|
$cache_group | string | A group must be set to to enable caching. | |
$changes | array | Core data changes for this object. | |
$data | array | Core data for this object. Name value pairs (name + default value). | |
$data_store | object | Contains a reference to the data store for this class. | |
$default_data | array | Set to _data on construct so we can track and reset data if needed. | |
$extra_data | array | Used as a standard way for sub classes (like product types) to add additional information to an inherited class. | |
$id | integer | ID for this object. | |
$meta_data | array | Stores additonal meta data. | |
$object_read | boolean | This is false until the object is read from the DB. |
Method | Description | |
---|---|---|
__construct ( integer | object | array $read ) | Default constructor. | |
__toString ( ) : string | Change data to JSON format. | |
add_meta_data ( string $key, string $value, boolean $unique = false ) | Add meta data. | |
apply_changes ( ) | Merge changes with data and clear. | |
delete ( boolean $force_delete = false ) : boolean | Delete an object, set the ID to 0, and return result. | |
delete_meta_data ( array $key ) | Delete meta data. | |
delete_meta_data_by_mid ( integer $mid ) | Delete meta data. | |
get_changes ( ) : array | Return data changes only. | |
get_data ( ) : array | Returns all data for this object. | |
get_data_keys ( ) : array | Returns array of expected data keys for this object. | |
get_data_store ( ) : object | Get the data store. | |
get_extra_data_keys ( ) : array | Returns all "extra" data keys for an object (for sub objects like product types). | |
get_id ( ) : integer | Returns the unique ID for this object. | |
get_meta ( string $key = '', boolean $single = true, string $context = 'view' ) : mixed | Get Meta Data by Key. | |
get_meta_data ( ) : array | Get All Meta Data. | |
get_object_read ( ) : boolean | Get object read property. | |
read_meta_data ( boolean $force_read = false ) | Read Meta Data from the database. Ignore any internal properties. | |
save ( ) : integer | Save should create or update based on object existance. | |
save_meta_data ( ) | Update Meta Data in the database. | |
set_defaults ( ) | Set all props to default values. | |
set_id ( integer $id ) | Set ID. | |
set_meta_data ( array $data ) | Set all meta data from array. | |
set_object_read ( boolean $read = true ) | Set object read property. | |
set_props ( array $props, $context = 'set' ) : WP_Error | boolean | Set a collection of props in one go, collect any errors, and return the result. | |
update_meta_data ( string $key, string $value, integer $meta_id = '' ) | Update meta data by key or ID, if provided. |
Method | Description | |
---|---|---|
error ( string $error_code, string $error_message ) | When invalid data is found, throw an exception unless reading from the DB. | |
filter_null_meta ( $meta ) : boolean | Filter null meta values from array. | |
get_hook_prefix ( ) : string | Prefix for action and filter hooks on data. | |
get_prop ( string $prop, string $context = 'view' ) : mixed | Gets a prop for a getter method. | |
set_prop ( string $prop, mixed $value ) | Sets a prop for a setter method. |
public __toString ( ) : string | ||
return | string | Data in JSON format. |
public delete_meta_data ( array $key ) | ||
$key | array | Meta key |
public delete_meta_data_by_mid ( integer $mid ) | ||
$mid | integer | Meta ID |
protected filter_null_meta ( $meta ) : boolean | ||
return | boolean |
public get_data_keys ( ) : array | ||
return | array |
public get_extra_data_keys ( ) : array | ||
return | array |
protected get_hook_prefix ( ) : string | ||
return | string |
public get_object_read ( ) : boolean | ||
return | boolean |
public read_meta_data ( boolean $force_read = false ) | ||
$force_read | boolean | True to force a new DB read (and update cache). |
public set_meta_data ( array $data ) | ||
$data | array | Key/Value pairs |
public set_object_read ( boolean $read = true ) | ||
$read | boolean |
protected string $cache_group | ||
return | string |
protected array $changes | ||
return | array |
protected array $data | ||
return | array |
protected object $data_store | ||
return | object |
protected array $default_data | ||
return | array |
protected array $extra_data | ||
return | array |
protected array $meta_data | ||
return | array |
protected bool $object_read | ||
return | boolean |