ExpirationTrait
Trait for tables that support expiration
Tags
Table of Contents
- deleteExpired() : int
- Delete expired records. Allows setting of 'from' and 'to' ID's so that rows can be deleted in small batches.
- expirationCallback() : void
- Update the select statement to find records to delete.
- getExpiredBatchLastId() : int|null
- Get the highest id to delete in a batch.
Methods
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
expirationCallback()
Update the select statement to find records to delete.
protected
abstract 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