VuFind API Documentation

UserResourceServiceInterface extends DbServiceInterface

Database service interface 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

Table of Contents

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).
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.
unlinkFavorites()  : void
Unlink rows for the specified resource.

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

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