AccessToken
extends Gateway
in package
Uses
ExpirationTrait
Table Definition for access_token
Tags
Table of Contents
- $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.
- getByIdAndType() : AccessToken|null
- Retrieve an object from the database based on id and type; create a new row if no existing match is found.
- getDbTable() : Gateway
- Get access to another table.
- getNonce() : string|null
- Retrieve an OpenID nonce for a user
- initializeFeatures() : void
- Initialize features
- rollBackTransaction() : void
- Roll back a database transaction.
- storeNonce() : void
- Add or replace an OpenID nonce for a user
- expirationCallback() : void
- Update the select statement to find records to delete.
- getExpiredBatchLastId() : int|null
- Get the highest id to delete in a batch.
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 = 'access_token' ]) : 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 = 'access_token'
-
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
getByIdAndType()
Retrieve an object from the database based on id and type; create a new row if no existing match is found.
public
getByIdAndType(string $id, string $type[, bool $create = true ]) : AccessToken|null
Parameters
- $id : string
-
Token ID
- $type : string
-
Token type
- $create : bool = true
-
Should we create rows that don't already exist?
Return values
AccessToken|null —getDbTable()
Get access to another table.
public
getDbTable(string $table) : Gateway
Parameters
- $table : string
-
Table name
Return values
Gateway —getNonce()
Retrieve an OpenID nonce for a user
public
getNonce(int $userId) : string|null
Parameters
- $userId : int
-
User ID
Return values
string|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 —storeNonce()
Add or replace an OpenID nonce for a user
public
storeNonce(int $userId, string|null $nonce) : void
Parameters
- $userId : int
-
User ID
- $nonce : string|null
-
Nonce
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