ApplicationMapper
extends Mapper
in package
Class ApplicationMapper.
Mapper class for DB calls used for the application table.
Table of Contents
- $db : ADOConnection
- DB connector.
- $logger : MonologWrapper
- Logger object.
- __construct() : mixed
- Mapper constructor.
- delete() : bool
- Delete an application.
- findAll() : array<string|int, mixed>
- Find applications.
- findByAccid() : array<string|int, mixed>
- Find applications by account ID.
- findByAccidAppname() : Application
- Find application by account ID and application name.
- findByAccidsAppnames() : array<string|int, mixed>
- Find applications by multiple account IDs and/or application names.
- findByAppid() : Application
- Find application by application ID.
- findByUid() : array<string|int, mixed>
- Fetch applications for a user.
- save() : bool
- Save an Application object.
- 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() : Application
- Map a DB row into an Application object.
- saveDelete() : bool
- Perform a save or delete.
Properties
$db
DB connector.
protected
ADOConnection
$db
DB Instance.
$logger
Logger object.
protected
MonologWrapper
$logger
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 application.
public
delete(Application $application) : bool
Parameters
- $application : Application
-
Application object.
Tags
Return values
bool —Success.
findAll()
Find applications.
public
findAll([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed> = []
-
Filter params.
Tags
Return values
array<string|int, mixed> —Array of Application objects.
findByAccid()
Find applications by account ID.
public
findByAccid(int $accid) : array<string|int, mixed>
Parameters
- $accid : int
-
Account ID.
Tags
Return values
array<string|int, mixed> —Array of mapped Application objects.
findByAccidAppname()
Find application by account ID and application name.
public
findByAccidAppname(int $accid, string $name) : Application
Parameters
- $accid : int
-
Account ID.
- $name : string
-
Application name.
Tags
Return values
Application —Application object.
findByAccidsAppnames()
Find applications by multiple account IDs and/or application names.
public
findByAccidsAppnames([array<string|int, mixed> $accids = [] ][, array<string|int, mixed> $appNames = [] ][, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
- $accids : array<string|int, mixed> = []
-
Array of account IDs.
- $appNames : array<string|int, mixed> = []
-
Array of account IDs.
- $params : array<string|int, mixed> = []
-
Parameters (optional).
Tags
Return values
array<string|int, mixed> —array of mapped Application objects.
findByAppid()
Find application by application ID.
public
findByAppid(int $appid) : Application
Parameters
- $appid : int
-
Application ID.
Tags
Return values
Application —Application object.
findByUid()
Fetch applications for a user.
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
Return values
array<string|int, mixed> —Array of Application objects.
save()
Save an Application object.
public
save(Application $application) : bool
Parameters
- $application : Application
-
The Application object.
Tags
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
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
Return values
array<string|int, mixed> —Array of mapped rows.
mapArray()
Map a DB row into an Application object.
protected
mapArray(array<string|int, mixed> $row) : Application
Parameters
- $row : array<string|int, mixed>
-
DB row object.
Return values
Application —Application 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
Return values
bool —Success status.