\TriTan\CommonMetaData

Summary

Methods
Properties
Constants
__construct()
read()
update()
create()
delete()
exists()
readByMid()
updateByMid()
deleteByMid()
updateMetaDataCache()
$db
$context
No constants found
table()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$db

$db : object

Laci document object.

Type

object

$context

$context : 

Type

Methods

read()

read(string  $meta_type, integer  $array_id, string  $meta_key = '',   $single = false) : mixed

Retrieve metadata for the specified array.

Parameters

string $meta_type

Type of array metadata is for (e.g. post or user)

integer $array_id

ID of the array metadata is for

string $meta_key

Optional. Metadata key. If not specified, retrieve all metadata for the specified array.

$single

Returns

mixed —

Array of values

update()

update(string  $meta_type, integer  $array_id, string  $meta_key, mixed  $meta_value, mixed  $prev_value = '') : integer|boolean

Update metadata for the specified array. If no value already exists for the specified array ID and metadata key, the metadata will be added.

Parameters

string $meta_type

Type of array metadata is for (e.g. post or user)

integer $array_id

ID of the array metadata is for

string $meta_key

Metadata key

mixed $meta_value

Metadata value. Must be serializable if non-scalar.

mixed $prev_value

Optional. If specified, only update existing metadata entries with the specified value. Otherwise, update all entries.

Returns

integer|boolean —

Meta ID if the key didn't exist, true on successful update, false on failure.

create()

create(string  $meta_type, integer  $array_id, string  $meta_key, mixed  $meta_value,   $unique = false) : integer|false

Add metadata for the specified array.

Parameters

string $meta_type

Type of array metadata is for (e.g. post or user)

integer $array_id

ID of the array metadata is for

string $meta_key

Metadata key

mixed $meta_value

Metadata value. Must be serializable if non-scalar.

$unique

Returns

integer|false —

The meta ID on success, false on failure.

delete()

delete(string  $meta_type, integer  $array_id, string  $meta_key, mixed  $meta_value = '', boolean  $delete_all = false) : boolean

Delete metadata for the specified array.

Parameters

string $meta_type

Type of array metadata is for (e.g. post or user)

integer $array_id

ID of the array metadata is for

string $meta_key

Metadata key

mixed $meta_value

Optional. Metadata value. Must be serializable if non-scalar. If specified, only delete metadata entries with this value. Otherwise, delete all entries with the specified meta_key. Pass null,false`, or an empty string to skip this check. (For backward compatibility, it is not possible to pass an empty string to delete those entries with an empty string for a value.)

boolean $delete_all

Optional, default is false. If true, delete matching metadata entries for all arrays, ignoring the specified array_id. Otherwise, only delete matching metadata entries for the specified array_id.

Returns

boolean —

True on successful delete, false on failure.

exists()

exists(string  $meta_type, integer  $array_id, string  $meta_key) : boolean

Determine if a meta key is set for a given array

Parameters

string $meta_type

Type of array metadata is for (e.g. post or user)

integer $array_id

ID of the array metadata is for

string $meta_key

Metadata key.

Returns

boolean —

True of the key is set, false if not.

readByMid()

readByMid(string  $meta_type, integer  $meta_id) : array|false

Get meta data by meta ID.

Parameters

string $meta_type

Type of array metadata is for (e.g. post or user).

integer $meta_id

ID for a specific meta row

Returns

array|false —

Meta array or false.

updateByMid()

updateByMid(string  $meta_type, integer  $meta_id, string  $meta_value, string  $meta_key = false) : boolean

Update meta data by meta ID

Parameters

string $meta_type

Type of array metadata is for (e.g. post or user)

integer $meta_id

ID for a specific meta row

string $meta_value

Metadata value

string $meta_key

Optional, you can provide a meta key to update it

Returns

boolean —

True on successful update, false on failure.

deleteByMid()

deleteByMid(string  $meta_type, integer  $meta_id) : boolean

Delete meta data by meta ID

Parameters

string $meta_type

Type of array metadata is for (e.g. post or user).

integer $meta_id

ID for a specific meta row

Returns

boolean —

True on successful delete, false on failure.

updateMetaDataCache()

updateMetaDataCache(string  $meta_type, integer|array  $array_ids) : array|false

Update the metadata cache for the specified arrays.

Parameters

string $meta_type

Type of array metadata is for (e.g., post or user)

integer|array $array_ids

Array or comma delimited list of array IDs to update cache for

Returns

array|false —

Metadata cache for the specified arrays, or false on failure.

table()

table(string  $type) : string

Retrieve the name of the metadata table for the specified object type.

This public function is not to be used by developers. It's use is only for _metadata methods.

Parameters

string $type

Type of object to get metadata table for (e.g. post or user)

Returns

string —

Metadata document name.