ApiOpenStudio PHPDoc

AccountMapper extends Mapper
in package

Class AccountMapper.

Mapper class for DB calls used for the account table.

Table of Contents

$db  : ADOConnection
DB connector.
$logger  : MonologWrapper
Logger object.
__construct()  : mixed
Mapper constructor.
delete()  : bool
Delete an account.
findAll()  : array<string|int, mixed>
Find an accounts.
findAllForUser()  : array<string|int, mixed>
Find an accounts by a user has roles for.
findByAccid()  : Account
Find an account by ID.
findByAccids()  : array<string|int, mixed>
Find accounts by IDs.
findByName()  : Account
Find an account by name.
findByNames()  : array<string|int, mixed>
Find an accounts by names.
save()  : bool
Save an Account.
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()  : Account
Map a DB row into an Account object.
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 an account.

public delete(Account $account) : bool
Parameters
$account : Account

Account object.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
bool

Success.

findAll()

Find an accounts.

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

Filter parameters.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

array Account objects.

findAllForUser()

Find an accounts by a user has roles for.

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

User ID.

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

Filter parameters.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

Array of Account objects.

findByAccid()

Find an account by ID.

public findByAccid(int $accid) : Account
Parameters
$accid : int

Account Id.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
Account

Account object.

findByAccids()

Find accounts by IDs.

public findByAccids(array<string|int, mixed> $accids) : array<string|int, mixed>
Parameters
$accids : array<string|int, mixed>

Account Ids.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

Array of Account objects.

findByName()

Find an account by name.

public findByName(string $name) : Account
Parameters
$name : string

Account name.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
Account

Account object.

findByNames()

Find an accounts by names.

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

Account names.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

array of Account object.

save()

Save an Account.

public save(Account $account) : bool
Parameters
$account : Account

Account object.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
bool

Success.

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 DB row into an Account object.

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

DB row object.

Return values
Account

Account object.

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