ApiOpenStudio PHPDoc

UserMapper extends Mapper
in package

Class UserMapper.

Mapper class for DB calls used for the user table.

Table of Contents

$db  : ADOConnection
DB connector.
$logger  : MonologWrapper
Logger object.
__construct()  : mixed
Mapper constructor.
delete()  : bool
Delete a user.
findAll()  : array<string|int, mixed>
Find allUsers
findAllByPermissions()  : array<string|int, mixed>
Find all users. If the calling uid does not have elevated access, only return that user.
findByEmail()  : User
Find a user by email address.
findByPasswordToken()  : User
Find a user by their password reset token.
findByUid()  : User
Find a user by user ID.
findByUsername()  : User
Find user bu username.
save()  : bool
Save the user.
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()  : User
Map a DB row into a User 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 a user.

public delete(User $user) : bool
Parameters
$user : User

The user object.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
bool

Success.

findAll()

Find allUsers

public findAll() : array<string|int, mixed>
Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

User objects.

findAllByPermissions()

Find all users. If the calling uid does not have elevated access, only return that user.

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

User ID of the current user.

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

Filter parameters.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

$array of Users.

findByEmail()

Find a user by email address.

public findByEmail(string $email) : User
Parameters
$email : string

Users email.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
User

User row.

findByPasswordToken()

Find a user by their password reset token.

public findByPasswordToken(string $token) : User
Parameters
$token : string

User auth token.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
User

User row.

findByUid()

Find a user by user ID.

public findByUid(int $uid) : User
Parameters
$uid : int

User ID.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
User

User row.

findByUsername()

Find user bu username.

public findByUsername(string $username) : User
Parameters
$username : string

Users username.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
User

User row.

save()

Save the user.

public save(User $user) : bool
Parameters
$user : User

User 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 a User object.

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

DB row object.

Return values
User

Mapped User 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