SLPĀ® phpDocs

MySLP_Accounting_Keys

Accounting key catalog table management and CRUD helpers.

Table of Contents

Constants

INSTALLED_VERSION_OPTION  : mixed = 'myslp_accounting_keys_installed_version'
TABLE_SLUG  : mixed = 'slp_accounting_keys'
VALID_CATEGORIES  : mixed = array('Income', 'Expense')

Methods

create_record()  : array<string, int|string>|WP_Error
Create a new key record.
delete_record()  : true|WP_Error
Delete a key record.
get_category_map()  : array<string, string>
Return a map of entry_key => category for the stable key catalog.
get_record()  : array<string, int|string>|null
Retrieve one key record by ID.
get_table_name()  : string
Return the multisite main-site table name.
list_key_names()  : array<int, string>
Return the distinct stable key catalog.
list_records()  : array{records: array>, total: int}
Fetch a paginated list of key records.
maybe_update_schema()  : void
Create or update the accounting keys table once per plugin version.
update_record()  : array<string, int|string>|WP_Error
Update an existing key record.
format_record()  : array<string, int|string>
Format a DB row into the REST response shape.
map_orderby()  : string
Map safe sort aliases to SQL columns.
sanitize_record_input()  : array<string, string>|WP_Error
Normalize and validate key record input.

Constants

INSTALLED_VERSION_OPTION

private mixed INSTALLED_VERSION_OPTION = 'myslp_accounting_keys_installed_version'

Methods

create_record()

Create a new key record.

public static create_record(array<string|int, mixed> $data) : array<string, int|string>|WP_Error
Parameters
$data : array<string|int, mixed>
Return values
array<string, int|string>|WP_Error

delete_record()

Delete a key record.

public static delete_record(int $id) : true|WP_Error
Parameters
$id : int
Return values
true|WP_Error

get_category_map()

Return a map of entry_key => category for the stable key catalog.

public static get_category_map() : array<string, string>
Return values
array<string, string>

get_record()

Retrieve one key record by ID.

public static get_record(int $id) : array<string, int|string>|null
Parameters
$id : int
Return values
array<string, int|string>|null

get_table_name()

Return the multisite main-site table name.

public static get_table_name() : string
Return values
string

list_key_names()

Return the distinct stable key catalog.

public static list_key_names() : array<int, string>
Return values
array<int, string>

list_records()

Fetch a paginated list of key records.

public static list_records(array<string|int, mixed> $args) : array{records: array>, total: int}
Parameters
$args : array<string|int, mixed>
Return values
array{records: array>, total: int}

maybe_update_schema()

Create or update the accounting keys table once per plugin version.

public static maybe_update_schema() : void

update_record()

Update an existing key record.

public static update_record(int $id, array<string|int, mixed> $data) : array<string, int|string>|WP_Error
Parameters
$id : int
$data : array<string|int, mixed>
Return values
array<string, int|string>|WP_Error

format_record()

Format a DB row into the REST response shape.

private static format_record(array<string|int, mixed> $row) : array<string, int|string>
Parameters
$row : array<string|int, mixed>
Return values
array<string, int|string>

map_orderby()

Map safe sort aliases to SQL columns.

private static map_orderby(string $orderby) : string
Parameters
$orderby : string
Return values
string

sanitize_record_input()

Normalize and validate key record input.

private static sanitize_record_input(array<string|int, mixed> $data) : array<string, string>|WP_Error
Parameters
$data : array<string|int, mixed>
Return values
array<string, string>|WP_Error
On this page

Search results