VuFind API Documentation

ResourceTagsServiceInterface extends DbServiceInterface

Database service interface for resource_tags.

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

assignAnonymousTags()  : void
Assign anonymous tags to the specified user.
changeResourceId()  : void
Change all matching rows to use the new resource ID instead of the old one (called when an ID changes).
createEntity()  : ResourceTagsEntityInterface
Create a ResourceTagsEntityInterface object.
createLink()  : void
Create a resource_tags row linking the specified resources
deduplicate()  : void
Deduplicate rows (sometimes necessary after merging foreign key IDs).
deleteLinksByResourceTagsIdArray()  : int
Remove links from the resource_tags table based on an array of IDs.
deleteResourceTags()  : int
Delete resource tags rows matching specified filter(s). Return count of IDs deleted.
destroyAllListResourceTagsLinksForUser()  : void
Unlink all tag rows associated with favorite lists for the specified resource and user. Tags added directly to records outside of favorites will not be impacted.
destroyNonListResourceTagsLinksForUser()  : void
Unlink tag rows that are not associated with a favorite list for the specified resource and user.
destroyResourceTagsLinksForUser()  : void
Unlink tag rows for the specified resource and user.
destroyUserListLinks()  : void
Unlink rows for the specified user list. This removes tags ON THE LIST ITSELF, not tags on resources within the list.
getAnonymousCount()  : int
Get count of anonymous tags
getResourceTagsPaginator()  : Paginator
Get Resource Tags Paginator
getUniqueResources()  : array<string|int, array<string|int, mixed>>
Gets unique tagged resources from the database.
getUniqueTags()  : array<string|int, array<string|int, mixed>>
Gets unique tags from the database.
getUniqueUsers()  : array<string|int, array<string|int, mixed>>
Gets unique users from the database.
persistEntity()  : void
Persist an entity.

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 a resource_tags row linking the specified resources

public createLink(ResourceEntityInterface|int|null $resourceOrId, TagsEntityInterface|int $tagOrId[, UserEntityInterface|int|null $userOrId = null ][, UserListEntityInterface|int|null $listOrId = null ][, DateTime|null $posted = null ]) : void
Parameters
$resourceOrId : ResourceEntityInterface|int|null

Resource entity or ID to link up (optional)

$tagOrId : TagsEntityInterface|int

Tag entity or ID to link up

$userOrId : UserEntityInterface|int|null = null

User entity or ID creating link (optional but recommended)

$listOrId : UserListEntityInterface|int|null = null

List entity or ID to link up (optional)

$posted : DateTime|null = null

Posted date (optional -- omit for current)

Return values
void

deduplicate()

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

public deduplicate() : void
Return values
void

deleteLinksByResourceTagsIdArray()

Remove links from the resource_tags table based on an array of IDs.

public deleteLinksByResourceTagsIdArray(array<string|int, string> $ids) : int
Parameters
$ids : array<string|int, string>

Identifiers from resource_tags to delete.

Return values
int

Count of $ids

deleteResourceTags()

Delete resource tags rows matching specified filter(s). Return count of IDs deleted.

public deleteResourceTags([int|null $userId = null ][, int|null $resourceId = null ][, int|null $tagId = null ]) : int
Parameters
$userId : int|null = null

ID of user (null for any)

$resourceId : int|null = null

ID of the resource (null for any)

$tagId : int|null = null

ID of the tag (null for any)

Return values
int

destroyAllListResourceTagsLinksForUser()

Unlink all tag rows associated with favorite lists for the specified resource and user. Tags added directly to records outside of favorites will not be impacted.

public destroyAllListResourceTagsLinksForUser(int|array<string|int, int>|null $resourceId, UserEntityInterface|int $userOrId[, int|array<string|int, int>|null $tagId = 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

$tagId : int|array<string|int, int>|null = null

ID or array of IDs of tag(s) to unlink (null for ALL matching tags)

Return values
void

destroyNonListResourceTagsLinksForUser()

Unlink tag rows that are not associated with a favorite list for the specified resource and user.

public destroyNonListResourceTagsLinksForUser(int|array<string|int, int>|null $resourceId, UserEntityInterface|int $userOrId[, int|array<string|int, int>|null $tagId = 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

$tagId : int|array<string|int, int>|null = null

ID or array of IDs of tag(s) to unlink (null for ALL matching tags)

Return values
void

destroyResourceTagsLinksForUser()

Unlink tag rows for the specified resource and user.

public destroyResourceTagsLinksForUser(int|array<string|int, int>|null $resourceId, UserEntityInterface|int $userOrId[, UserListEntityInterface|int|null $listOrId = null ][, int|array<string|int, int>|null $tagId = 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

$listOrId : UserListEntityInterface|int|null = null

ID of list to unlink (null for ALL matching tags)

$tagId : int|array<string|int, int>|null = null

ID or array of IDs of tag(s) to unlink (null for ALL matching tags)

Return values
void

Unlink rows for the specified user list. This removes tags ON THE LIST ITSELF, not tags on resources within the list.

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

ID or entity representing list

$userOrId : UserEntityInterface|int

ID or entity representing user

$tagId : int|array<string|int, int>|null = null

ID or array of IDs of tag(s) to unlink (null for ALL matching tags)

Return values
void

getResourceTagsPaginator()

Get Resource Tags Paginator

public getResourceTagsPaginator([int|null $userId = null ][, int|null $resourceId = null ][, int|null $tagId = null ][, string|null $order = null ][, int|null $page = null ][, int $limit = 20 ][, bool $caseSensitiveTags = false ]) : Paginator
Parameters
$userId : int|null = null

ID of user (null for any)

$resourceId : int|null = null

ID of the resource (null for any)

$tagId : int|null = null

ID of the tag (null for any)

$order : string|null = null

The order in which to return the data

$page : int|null = null

The page number to select

$limit : int = 20

The number of items to fetch

$caseSensitiveTags : bool = false

Should we treat tags as case-sensitive?

Return values
Paginator

getUniqueResources()

Gets unique tagged resources from the database.

public getUniqueResources([int|null $userId = null ][, int|null $resourceId = null ][, int|null $tagId = null ]) : array<string|int, array<string|int, mixed>>
Parameters
$userId : int|null = null

ID of user (null for any)

$resourceId : int|null = null

ID of the resource (null for any)

$tagId : int|null = null

ID of the tag (null for any)

Return values
array<string|int, array<string|int, mixed>>

getUniqueTags()

Gets unique tags from the database.

public getUniqueTags([int|null $userId = null ][, int|null $resourceId = null ][, int|null $tagId = null ][, bool $caseSensitive = false ]) : array<string|int, array<string|int, mixed>>
Parameters
$userId : int|null = null

ID of user (null for any)

$resourceId : int|null = null

ID of the resource (null for any)

$tagId : int|null = null

ID of the tag (null for any)

$caseSensitive : bool = false

Should we treat tags in a case-sensitive manner?

Return values
array<string|int, array<string|int, mixed>>

getUniqueUsers()

Gets unique users from the database.

public getUniqueUsers([int|null $userId = null ][, int|null $resourceId = null ][, int|null $tagId = null ]) : array<string|int, array<string|int, mixed>>
Parameters
$userId : int|null = null

ID of user (null for any)

$resourceId : int|null = null

ID of the resource (null for any)

$tagId : int|null = null

ID of the tag (null for any)

Return values
array<string|int, array<string|int, mixed>>

Search results