ApiOpenStudio PHPDoc

VarStoreMapper extends Mapper
in package

Class VarStoreMapper.

Mapper class for DB calls used for the var_store table.

Table of Contents

$db  : ADOConnection
DB connector.
$logger  : MonologWrapper
Logger object.
__construct()  : mixed
Mapper constructor.
delete()  : bool
Delete a var.
deleteMultiple()  : bool
Delete multiple vars.
findAll()  : array<string|int, mixed>
Return all vars.
findAllFilter()  : array<string|int, mixed>
Return all vars using AND logic for the filters
findByAccidKey()  : VarStore
Find a var by account ID and var key.
findByAppId()  : VarStore
Find the vars belonging to an application.
findByAppidKey()  : VarStore
Find a var by account ID and var key.
findByUid()  : array<string|int, mixed>
Return all vars that a user has access to.
findByUidAppidKey()  : VarStore
Return a var by appid/key that a user has access to.
findByUidRolesAll()  : array<string|int, mixed>
Find all vars with user/role validation against the vars's application.
findByUidRolesAppidKey()  : VarStore
Find a var by App ID and key with user/role validation.
findByUidVid()  : VarStore
Return a var by vid that a user has access to.
findByVid()  : VarStore
Find a var by its ID.
save()  : bool
Save the var.
fetchRow()  : mixed
Perform an SQL statement that expects a single row.
fetchRows()  : array<string|int, mixed>
Perform an SQL statement that expects multiple rows.
mapArray()  : VarStore
Map a results row to attributes.
saveDelete()  : bool
Perform a save or delete.

Properties

$db

DB connector.

protected ADOConnection $db

DB Instance.

Methods

__construct()

Mapper constructor.

public __construct(ADOConnection $dbLayer, MonologWrapper $logger) : mixed
Parameters
$dbLayer : ADOConnection

DB connection object.

$logger : MonologWrapper

Logger object.

Return values
mixed

delete()

Delete a var.

public delete(VarStore $varStore) : bool
Parameters
$varStore : VarStore

VarStore object.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
bool

Success.

deleteMultiple()

Delete multiple vars.

public deleteMultiple(array<string|int, VarStore$vars) : bool
Parameters
$vars : array<string|int, VarStore>

Array of VarStore object.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
bool

Success.

findAll()

Return all vars.

public findAll([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Filter params.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

Array of varStore objects.

findAllFilter()

Return all vars using AND logic for the filters

public findAllFilter([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Filter params.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

Array of varStore objects.

findByAccidKey()

Find a var by account ID and var key.

public findByAccidKey(int $accId, string $key) : VarStore
Parameters
$accId : int

Account ID.

$key : string

Var key.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
VarStore

VarStore object.

findByAppId()

Find the vars belonging to an application.

public findByAppId(int $appId) : VarStore
Parameters
$appId : int

Application ID.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
VarStore

VarStore object.

findByAppidKey()

Find a var by account ID and var key.

public findByAppidKey(int $appId, string $key) : VarStore
Parameters
$appId : int

Application ID.

$key : string

Var key.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
VarStore

VarStore object.

findByUid()

Return all vars that a user has access to.

public findByUid(int $uid[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$uid : int

User ID.

$params : array<string|int, mixed> = []

Filter params.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

Array of varStore objects.

findByUidAppidKey()

Return a var by appid/key that a user has access to.

public findByUidAppidKey(int $uid, int $appid, string $key) : VarStore
Parameters
$uid : int

User ID.

$appid : int

application ID.

$key : string

var key.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
VarStore

A VarStore object.

findByUidRolesAll()

Find all vars with user/role validation against the vars's application.

public findByUidRolesAll(int $uid, array<string|int, mixed> $roles, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$uid : int

User ID.

$roles : array<string|int, mixed>

Role names.

$params : array<string|int, mixed>

Keyword, order and direction.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

findByUidRolesAppidKey()

Find a var by App ID and key with user/role validation.

public findByUidRolesAppidKey(int $uid, array<string|int, mixed> $roles, int $appid, string $key) : VarStore
Parameters
$uid : int

User ID.

$roles : array<string|int, mixed>

Role IDs.

$appid : int

App ID.

$key : string

variable key.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
VarStore

A VarStore object.

findByUidVid()

Return a var by vid that a user has access to.

public findByUidVid(int $uid, int $vid) : VarStore
Parameters
$uid : int

User ID.

$vid : int

var ID.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
VarStore

A VarStore object.

findByVid()

Find a var by its ID.

public findByVid(int $vid) : VarStore
Parameters
$vid : int

Var ID.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
VarStore

Find a varStore by its ID.

fetchRow()

Perform an SQL statement that expects a single row.

protected fetchRow(string $sql, array<string|int, mixed> $bindParams) : mixed
Parameters
$sql : string

Query string.

$bindParams : array<string|int, mixed>

Array of bind params.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
mixed

Mapped row.

fetchRows()

Perform an SQL statement that expects multiple rows.

protected fetchRows(string $sql[, array<string|int, mixed> $bindParams = [] ][, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$sql : string

Query string.

$bindParams : array<string|int, mixed> = []

Array of bind params.

$params : array<string|int, mixed> = []

Parameters (optional). Example: [ 'filter' => [ 'keyword' => string, 'column' => string, ] 'order_by' => string, 'direction' => string "ASC"|"DESC", 'offset' => int, 'limit' => int, ] NOTE: * This will throw an exception if the sql already contains a WHERE clause and should be calculated separately in these cases. * ['filter']['keyword'] '%' characters in keyword not added to keyword automatically.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

Array of mapped rows.

mapArray()

Map a results row to attributes.

protected mapArray(array<string|int, mixed> $row) : VarStore
Parameters
$row : array<string|int, mixed>

DB results row.

Return values
VarStore

Mapped row.

saveDelete()

Perform a save or delete.

protected saveDelete(string $sql, array<string|int, mixed> $bindParams) : bool
Parameters
$sql : string

Query string.

$bindParams : array<string|int, mixed>

Array of bind params.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
bool

Success status.

Search results