VuFind API Documentation

UserResourceService extends AbstractDbService
in package
implements DbTableAwareInterface, DbServiceAwareInterface, UserResourceServiceInterface Uses DbServiceAwareTrait, DbTableAwareTrait

Database service for UserResource.

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

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

link

Wiki

Interfaces, Classes, Traits and Enums

DbTableAwareInterface
Marker interface for classes that depend on the \VuFind\Db\Table\PluginManager
DbServiceAwareInterface
Marker interface for classes that depend on the \VuFind\Db\Service\PluginManager
UserResourceServiceInterface
Database service interface for UserResource.

Table of Contents

$dbServiceManager  : PluginManager
Database service plugin manager
$tableManager  : PluginManager
Database table plugin manager
changeResourceId()  : void
Change all matching rows to use the new resource ID instead of the old one (called when an ID changes).
createEntity()  : UserResourceEntityInterface
Create a UserResource entity object.
createOrUpdateLink()  : UserResource|false
Create user/resource/list link if one does not exist; update notes if one does.
deduplicate()  : void
Deduplicate rows (sometimes necessary after merging foreign key IDs).
getDbService()  : T
Get a database service object.
getDbServiceManager()  : PluginManager
Get the service plugin manager. Throw an exception if it is missing.
getDbTable()  : Gateway
Get a database table object.
getDbTableManager()  : PluginManager
Get the table plugin manager. Throw an exception if it is missing.
getFavoritesForRecord()  : array<string|int, UserResourceEntityInterface>
Get information saved in a user's favorites for a particular record.
getStatistics()  : array<string|int, mixed>
Get statistics on use of UserResource.
persistEntity()  : void
Persist an entity.
setDbServiceManager()  : void
Set the service plugin manager.
setDbTableManager()  : void
Set the table plugin manager.
unlinkFavorites()  : void
Unlink rows for the specified resource.

Properties

Methods

changeResourceId()

Change all matching rows to use the new resource ID instead of the old one (called when an ID changes).

public changeResourceId(int $old, int $new) : void
Parameters
$old : int

Original resource ID

$new : int

New resource ID

Return values
void

Create user/resource/list link if one does not exist; update notes if one does.

public createOrUpdateLink(ResourceEntityInterface|int $resourceOrId, UserEntityInterface|int $userOrId, UserListEntityInterface|int $listOrId[, string $notes = '' ]) : UserResource|false
Parameters
$resourceOrId : ResourceEntityInterface|int

Entity or ID of resource to link up

$userOrId : UserEntityInterface|int

Entity or ID of user creating link

$listOrId : UserListEntityInterface|int

Entity or ID of list to link up

$notes : string = ''

Notes to associate with link

Return values
UserResource|false

deduplicate()

Deduplicate rows (sometimes necessary after merging foreign key IDs).

public deduplicate() : void
Return values
void

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 a database table object.

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

Table to load.

Return values
Gateway

getFavoritesForRecord()

Get information saved in a user's favorites for a particular record.

public getFavoritesForRecord(string $recordId[, string $source = DEFAULT_SEARCH_BACKEND ][, UserListEntityInterface|int|null $listOrId = null ][, UserEntityInterface|int|null $userOrId = null ]) : array<string|int, UserResourceEntityInterface>
Parameters
$recordId : string

ID of record being checked.

$source : string = DEFAULT_SEARCH_BACKEND

Source of record to look up

$listOrId : UserListEntityInterface|int|null = null

Optional list entity or ID (to limit results to a particular list).

$userOrId : UserEntityInterface|int|null = null

Optional user entity or ID (to limit results to a particular user).

Return values
array<string|int, UserResourceEntityInterface>

getStatistics()

Get statistics on use of UserResource.

public getStatistics() : array<string|int, mixed>
Return values
array<string|int, mixed>

unlinkFavorites()

Unlink rows for the specified resource.

public unlinkFavorites(int|array<string|int, int>|null $resourceId, UserEntityInterface|int $userOrId[, UserListEntityInterface|int $listOrId = null ]) : void
Parameters
$resourceId : int|array<string|int, int>|null

ID (or array of IDs) of resource(s) to unlink (null for ALL matching resources)

$userOrId : UserEntityInterface|int

ID or entity representing user removing links

$listOrId : UserListEntityInterface|int = null

ID or entity representing list to unlink (null for ALL matching lists)

Return values
void

Search results