ExternalSession
extends Gateway
in package
implements
DbServiceAwareInterface
Uses
DbServiceAwareTrait, ExpirationTrait
Table Definition for external_session
Tags
Interfaces, Classes, Traits and Enums
- DbServiceAwareInterface
- Marker interface for classes that depend on the \VuFind\Db\Service\PluginManager
Table of Contents
- $dbServiceManager : PluginManager
- Database service plugin manager
- $tableManager : PluginManager
- Table manager
- __construct() : mixed
- Constructor
- addSessionMapping() : void
- Add a mapping between local and external session id's
- 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.
- destroySession() : void
- Destroy data for the given session ID.
- getByExternalSessionId() : ExternalSession|null
- Retrieve an object from the database based on an external session ID
- getDbService() : T
- Get a database service object.
- getDbServiceManager() : PluginManager
- Get the service plugin manager. Throw an exception if it is missing.
- getDbTable() : Gateway
- Get access to another table.
- initializeFeatures() : void
- Initialize features
- rollBackTransaction() : void
- Roll back a database transaction.
- setDbServiceManager() : void
- Set the service plugin manager.
- expirationCallback() : void
- Update the select statement to find records to delete.
- getExpiredBatchLastId() : int|null
- Get the highest id to delete in a batch.
Properties
$dbServiceManager
Database service plugin manager
protected
PluginManager
$dbServiceManager
$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 = 'external_session' ]) : 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 = 'external_session'
-
Name of database table to interface with
Return values
mixed —addSessionMapping()
Add a mapping between local and external session id's
public
addSessionMapping(string $localSessionId, string $externalSessionId) : void
Parameters
- $localSessionId : string
-
Local (VuFind) session id
- $externalSessionId : string
-
External session id
Tags
Return values
void —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
destroySession()
Destroy data for the given session ID.
public
destroySession(string $sid) : void
Parameters
- $sid : string
-
Session ID to erase
Tags
Return values
void —getByExternalSessionId()
Retrieve an object from the database based on an external session ID
public
getByExternalSessionId(string $sid) : ExternalSession|null
Parameters
- $sid : string
-
External session ID to retrieve
Tags
Return values
ExternalSession|null —getDbService()
Get a database service object.
public
getDbService(class-string<\VuFind\Db\Service\T> $name) : T
Parameters
- $name : class-string<\VuFind\Db\Service\T>
-
Name of service to retrieve
Tags
Return values
T —getDbServiceManager()
Get the service plugin manager. Throw an exception if it is missing.
public
getDbServiceManager() : PluginManager
Tags
Return values
PluginManager —getDbTable()
Get access to another table.
public
getDbTable(string $table) : Gateway
Parameters
- $table : string
-
Table name
Return values
Gateway —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 —setDbServiceManager()
Set the service plugin manager.
public
setDbServiceManager(PluginManager $manager) : void
Parameters
- $manager : PluginManager
-
Plugin manager
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