ChangeTrackerService
extends AbstractDbService
in package
implements
ChangeTrackerServiceInterface, DbTableAwareInterface
Uses
DbTableAwareTrait
Database service for change tracker.
Tags
Interfaces, Classes, Traits and Enums
- ChangeTrackerServiceInterface
- Database service interface for change tracker.
- DbTableAwareInterface
- Marker interface for classes that depend on the \VuFind\Db\Table\PluginManager
Table of Contents
- $dateFormat : string
- Format to use when sending dates to legacy code.
- $tableManager : PluginManager
- Database table plugin manager
- getChangeTrackerEntity() : ChangeTrackerEntityInterface|null
- Retrieve a row from the database based on primary key; return null if it is not found.
- getDbTable() : Gateway
- Get a database table object.
- getDbTableManager() : PluginManager
- Get the table plugin manager. Throw an exception if it is missing.
- getDeletedCount() : int
- Retrieve a count of deleted rows from the database.
- getDeletedEntities() : array<string|int, ChangeTrackerEntityInterface>
- Retrieve a set of deleted rows from the database.
- index() : ChangeTrackerEntityInterface
- Update the change_tracker table to reflect that a record has been indexed.
- markDeleted() : ChangeTrackerEntityInterface
- Update the change tracker table to indicate that a record has been deleted.
- persistEntity() : void
- Persist an entity.
- setDbTableManager() : void
- Set the table plugin manager.
Properties
$dateFormat
Format to use when sending dates to legacy code.
protected
string
$dateFormat
= 'Y-m-d H:i:s'
$tableManager
Database table plugin manager
protected
PluginManager
$tableManager
Methods
getChangeTrackerEntity()
Retrieve a row from the database based on primary key; return null if it is not found.
public
getChangeTrackerEntity(string $indexName, string $id) : ChangeTrackerEntityInterface|null
Parameters
- $indexName : string
-
The name of the Solr index holding the record.
- $id : string
-
The ID of the record being indexed.
Return values
ChangeTrackerEntityInterface|null —getDbTable()
Get a database table object.
public
getDbTable(string $table) : Gateway
Parameters
- $table : string
-
Table to load.
Return values
Gateway —getDbTableManager()
Get the table plugin manager. Throw an exception if it is missing.
public
getDbTableManager() : PluginManager
Tags
Return values
PluginManager —getDeletedCount()
Retrieve a count of deleted rows from the database.
public
getDeletedCount(string $indexName, DateTime $from, DateTime $until) : int
Parameters
- $indexName : string
-
The name of the Solr index holding the record.
- $from : DateTime
-
The beginning date of the range to search.
- $until : DateTime
-
The end date of the range to search.
Return values
int —getDeletedEntities()
Retrieve a set of deleted rows from the database.
public
getDeletedEntities(string $indexName, DateTime $from, DateTime $until, int $offset[, int|null $limit = null ]) : array<string|int, ChangeTrackerEntityInterface>
Parameters
- $indexName : string
-
The name of the Solr index holding the record.
- $from : DateTime
-
The beginning date of the range to search.
- $until : DateTime
-
The end date of the range to search.
- $offset : int
-
Record number to retrieve first.
- $limit : int|null = null
-
Retrieval limit (null for no limit)
Return values
array<string|int, ChangeTrackerEntityInterface> —index()
Update the change_tracker table to reflect that a record has been indexed.
public
index(string $core, string $id, int $change) : ChangeTrackerEntityInterface
We need to know the date of the last change to the record (independent of its addition to the index) in order to tell the difference between a reindex of a previously-encountered record and a genuine change.
The method returns the updated/created row when complete.
Parameters
- $core : string
-
The Solr core holding the record.
- $id : string
-
The ID of the record being indexed.
- $change : int
-
The timestamp of the last record change.
Return values
ChangeTrackerEntityInterface —markDeleted()
Update the change tracker table to indicate that a record has been deleted.
public
markDeleted(string $core, string $id) : ChangeTrackerEntityInterface
The method returns the updated/created row when complete.
Parameters
- $core : string
-
The Solr core holding the record.
- $id : string
-
The ID of the record being indexed.
Return values
ChangeTrackerEntityInterface —persistEntity()
Persist an entity.
public
persistEntity(EntityInterface $entity) : void
Parameters
- $entity : EntityInterface
-
Entity to persist.
Return values
void —setDbTableManager()
Set the table plugin manager.
public
setDbTableManager(PluginManager $manager) : void
Parameters
- $manager : PluginManager
-
Plugin manager