VuFind API Documentation

Resource extends Gateway
in package
implements DbServiceAwareInterface Uses DbServiceAwareTrait

Table Definition for resource

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Main Site

Interfaces, Classes, Traits and Enums

DbServiceAwareInterface
Marker interface for classes that depend on the \VuFind\Db\Service\PluginManager

Table of Contents

$dateConverter  : Converter
$dbServiceManager  : PluginManager
Database service plugin manager
$resourcePopulatorLoader  : callable
Loader for record populator
$tableManager  : PluginManager
Table manager
__construct()  : mixed
Constructor
applySort()  : void
Apply a sort parameter to a query on the resource table.
beginTransaction()  : void
Begin a database transaction.
commitTransaction()  : void
Commit a database transaction.
createRow()  : object
Create a new row.
findMissingMetadata()  : array<string|int, ResourceEntityInterface>
Get a set of records that do not have metadata stored in the resource table.
findResource()  : Resource|null
Look up a row for the specified resource.
findResources()  : array<string|int, ResourceEntityInterface>
Look up a rowset for a set of specified resources.
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.
getFavorites()  : AbstractResultSet
Get a set of records from the requested favorite list.
initializeFeatures()  : void
Initialize features
rollBackTransaction()  : void
Roll back a database transaction.
setDbServiceManager()  : void
Set the service plugin manager.
updateRecordId()  : void
Update the database to reflect a changed record identifier.

Properties

$dateConverter

protected Converter $dateConverter

$resourcePopulatorLoader

Loader for record populator

protected callable $resourcePopulatorLoader

Methods

__construct()

Constructor

public __construct(Adapter $adapter, PluginManager $tm, array<string|int, mixed> $cfg, RowGateway|null $rowObj, Converter $dateConverter, callable $resourcePopulatorLoader[, string $table = 'resource' ]) : 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)

$dateConverter : Converter

Date converter

$resourcePopulatorLoader : callable

Resource populator loader

$table : string = 'resource'

Name of database table to interface with

Return values
mixed

applySort()

Apply a sort parameter to a query on the resource table.

public static applySort(Select $query, string $sort[, string $alias = 'resource' ][, array<string|int, mixed> $columns = [] ]) : void
Parameters
$query : Select

Query to modify

$sort : string

Field to use for sorting (may include 'desc' qualifier)

$alias : string = 'resource'

Alias to the resource table (defaults to 'resource')

$columns : array<string|int, mixed> = []

Existing list of columns to select

Return values
void

beginTransaction()

Begin a database transaction.

public beginTransaction() : void
Tags
throws
Exception
Return values
void

commitTransaction()

Commit a database transaction.

public commitTransaction() : void
Tags
throws
Exception
Return values
void

createRow()

Create a new row.

public createRow() : object
Return values
object

findMissingMetadata()

Get a set of records that do not have metadata stored in the resource table.

public findMissingMetadata() : array<string|int, ResourceEntityInterface>
Tags
deprecated

Use \VuFind\Db\Service\ResourceServiceInterface::findMissingMetadata()

Return values
array<string|int, ResourceEntityInterface>

findResource()

Look up a row for the specified resource.

public findResource(string $id[, string $source = DEFAULT_SEARCH_BACKEND ][, bool $create = true ][, AbstractBase $driver = null ]) : Resource|null
Parameters
$id : string

Record ID to look up

$source : string = DEFAULT_SEARCH_BACKEND

Source of record to look up

$create : bool = true

If true, create the row if it does not yet exist.

$driver : AbstractBase = null

A record driver for the resource being created (optional -- improves efficiency if provided, but will be auto-loaded as needed if left null).

Tags
deprecated

Use ResourceServiceInterface::getResourceByRecordId() or \VuFind\Record\ResourcePopulator::getOrCreateResourceForDriver() or \VuFind\Record\ResourcePopulator::getOrCreateResourceForRecordId() as appropriate.

Return values
Resource|null

Matching row if found or created, null otherwise.

findResources()

Look up a rowset for a set of specified resources.

public findResources(array<string|int, mixed> $ids[, string $source = DEFAULT_SEARCH_BACKEND ]) : array<string|int, ResourceEntityInterface>
Parameters
$ids : array<string|int, mixed>

Array of IDs

$source : string = DEFAULT_SEARCH_BACKEND

Source of records to look up

Tags
deprecated

Use \VuFind\Db\Service\ResourceServiceInterface::getResourcesByRecordIds()

Return values
array<string|int, ResourceEntityInterface>

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
template

T

Return values
T

getDbTable()

Get access to another table.

public getDbTable(string $table) : Gateway
Parameters
$table : string

Table name

Return values
Gateway

getFavorites()

Get a set of records from the requested favorite list.

public getFavorites(string $user[, string $list = null ][, array<string|int, mixed> $tags = [] ][, string $sort = null ], int $offset[, int $limit = null ][, bool|null $caseSensitiveTags = null ]) : AbstractResultSet
Parameters
$user : string

ID of user owning favorite list

$list : string = null

ID of list to retrieve (null for all favorites)

$tags : array<string|int, mixed> = []

Tags to use for limiting results

$sort : string = null

Resource table field to use for sorting (null for no particular sort).

$offset : int

Offset for results

$limit : int = null

Limit for results (null for none)

$caseSensitiveTags : bool|null = null

Should tags be searched case sensitively (null for configured default)

Return values
AbstractResultSet

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
throws
Exception
Return values
void

updateRecordId()

Update the database to reflect a changed record identifier.

public updateRecordId(string $oldId, string $newId[, string $source = DEFAULT_SEARCH_BACKEND ]) : void
Parameters
$oldId : string

Original record ID

$newId : string

Revised record ID

$source : string = DEFAULT_SEARCH_BACKEND

Record source

Tags
deprecated

Use \VuFind\Record\RecordIdUpdater::updateRecordId()

Return values
void

Search results