AuthHash
extends Gateway
in package
Uses
ExpirationTrait
Table Definition for auth_hash
Tags
Table of Contents
- TYPE_EMAIL = 'email'
- $tableManager : PluginManager
- Table manager
- __construct() : mixed
- Constructor
- beginTransaction() : void
- Begin a database transaction.
- commitTransaction() : void
- Commit a database transaction.
- createRow() : object
- Create a new row.
- deleteExpired() : int
- Delete expired records. Allows setting of 'from' and 'to' ID's so that rows can be deleted in small batches.
- getByHashAndType() : AuthHash|null
- Retrieve an object from the database based on hash and type; create a new row if no existing match is found.
- getDbTable() : Gateway
- Get access to another table.
- getLatestBySessionId() : AuthHash|null
- Retrieve last object from the database based on session id.
- initializeFeatures() : void
- Initialize features
- rollBackTransaction() : void
- Roll back a database transaction.
- expirationCallback() : void
- Update the select statement to find records to delete.
- getExpiredBatchLastId() : int|null
- Get the highest id to delete in a batch.
Constants
TYPE_EMAIL
public
mixed
TYPE_EMAIL
= 'email'
Properties
$tableManager
Table manager
protected
PluginManager
$tableManager
Methods
__construct()
Constructor
public
__construct(Adapter $adapter, PluginManager $tm, array<string|int, mixed> $cfg[, RowGateway $rowObj = null ][, string $table = 'auth_hash' ]) : mixed
Parameters
- $adapter : Adapter
-
Database adapter
- $tm : PluginManager
-
Table manager
- $cfg : array<string|int, mixed>
-
Laminas configuration
- $rowObj : RowGateway = null
-
Row prototype object (null for default)
- $table : string = 'auth_hash'
-
Name of database table to interface with
Return values
mixed —beginTransaction()
Begin a database transaction.
public
beginTransaction() : void
Tags
Return values
void —commitTransaction()
Commit a database transaction.
public
commitTransaction() : void
Tags
Return values
void —createRow()
Create a new row.
public
createRow() : object
Return values
object —deleteExpired()
Delete expired records. Allows setting of 'from' and 'to' ID's so that rows can be deleted in small batches.
public
deleteExpired(string $dateLimit[, int|null $limit = null ]) : int
Parameters
- $dateLimit : string
-
Date threshold of an "expired" record in format 'Y-m-d H:i:s'.
- $limit : int|null = null
-
Maximum number of rows to delete or null for no limit.
Return values
int —Number of rows deleted
getByHashAndType()
Retrieve an object from the database based on hash and type; create a new row if no existing match is found.
public
getByHashAndType(string $hash, string $type[, bool $create = true ]) : AuthHash|null
Parameters
- $hash : string
-
Hash
- $type : string
-
Hash type
- $create : bool = true
-
Should we create rows that don't already exist?
Return values
AuthHash|null —getDbTable()
Get access to another table.
public
getDbTable(string $table) : Gateway
Parameters
- $table : string
-
Table name
Return values
Gateway —getLatestBySessionId()
Retrieve last object from the database based on session id.
public
getLatestBySessionId(string $sessionId) : AuthHash|null
Parameters
- $sessionId : string
-
Session ID
Return values
AuthHash|null —initializeFeatures()
Initialize features
public
initializeFeatures(array<string|int, mixed> $cfg) : void
Parameters
- $cfg : array<string|int, mixed>
-
Laminas configuration
Return values
void —rollBackTransaction()
Roll back a database transaction.
public
rollBackTransaction() : void
Tags
Return values
void —expirationCallback()
Update the select statement to find records to delete.
protected
expirationCallback(Select $select, string $dateLimit) : void
Parameters
- $select : Select
-
Select clause
- $dateLimit : string
-
Date threshold of an "expired" record in format 'Y-m-d H:i:s'.
Return values
void —getExpiredBatchLastId()
Get the highest id to delete in a batch.
protected
getExpiredBatchLastId(string $dateLimit, int $limit) : int|null
Parameters
- $dateLimit : string
-
Date threshold of an "expired" record in format 'Y-m-d H:i:s'.
- $limit : int
-
Maximum number of rows to delete.
Return values
int|null —Highest id value to delete or null if a limiting id is not available