ResourceTags
extends Gateway
in package
implements
DbServiceAwareInterface
Uses
DbServiceAwareTrait
Table Definition for resource_tags
Tags
Interfaces, Classes, Traits and Enums
- DbServiceAwareInterface
- Marker interface for classes that depend on the \VuFind\Db\Service\PluginManager
Table of Contents
- $caseSensitive : mixed
- $dbServiceManager : PluginManager
- Database service plugin manager
- $tableManager : PluginManager
- Table manager
- __construct() : mixed
- Constructor
- assignAnonymousTags() : void
- Assign anonymous tags to the specified user ID.
- beginTransaction() : void
- Begin a database transaction.
- checkForTags() : array<string|int, mixed>
- Check whether or not the specified tags are present in the table.
- commitTransaction() : void
- Commit a database transaction.
- createLink() : void
- Look up a row for the specified resource.
- createRow() : object
- Create a new row.
- deduplicate() : void
- Deduplicate rows (sometimes necessary after merging foreign key IDs).
- deleteByIdArray() : int
- Delete a group of tags.
- destroyListLinks() : void
- Unlink rows for the specified user list.
- destroyResourceLinks() : void
- Unlink rows for the specified resource.
- getAnonymousCount() : int
- Get count of anonymous tags
- 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.
- getDuplicates() : mixed
- Get a list of duplicate rows (this sometimes happens after merging IDs, for example after a Summon resource ID changes).
- getListsForTag() : AbstractResultSet
- Get lists associated with a particular tag.
- getResourcesForTag() : AbstractResultSet
- Get resources associated with a particular tag.
- getResourceTags() : Paginator
- Get Resource Tags
- getStatistics() : array<string|int, mixed>
- Get statistics on use of tags.
- getUniqueResources() : AbstractResultSet
- Gets unique resources from the table
- getUniqueTags() : AbstractResultSet
- Gets unique tags from the table
- getUniqueUsers() : AbstractResultSet
- Gets unique users from the table
- initializeFeatures() : void
- Initialize features
- rollBackTransaction() : void
- Roll back a database transaction.
- setDbServiceManager() : void
- Set the service plugin manager.
- formatTagOrder() : array<string|int, mixed>
- Given an array for sorting database results, make sure the tag field is sorted in a case-insensitive fashion.
- processDestroyLinks() : void
- Process link rows marked to be destroyed.
Properties
$caseSensitive
protected
mixed
$caseSensitive
= false
$dbServiceManager
Database service plugin manager
protected
PluginManager
$dbServiceManager
$tableManager
Table manager
protected
PluginManager
$tableManager
Methods
__construct()
Constructor
public
__construct(Adapter $adapter, PluginManager $tm, array<string|int, mixed> $cfg[, RowGateway $rowObj = null ][, bool $caseSensitive = false ][, string $table = 'resource_tags' ]) : 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)
- $caseSensitive : bool = false
-
Are tags case sensitive?
- $table : string = 'resource_tags'
-
Name of database table to interface with
Return values
mixed —assignAnonymousTags()
Assign anonymous tags to the specified user ID.
public
assignAnonymousTags(int $id) : void
Parameters
- $id : int
-
User ID to own anonymous tags.
Return values
void —beginTransaction()
Begin a database transaction.
public
beginTransaction() : void
Tags
Return values
void —checkForTags()
Check whether or not the specified tags are present in the table.
public
checkForTags(array<string|int, mixed> $ids) : array<string|int, mixed>
Parameters
- $ids : array<string|int, mixed>
-
IDs to check.
Tags
Return values
array<string|int, mixed> —Associative array with two keys: present and missing
commitTransaction()
Commit a database transaction.
public
commitTransaction() : void
Tags
Return values
void —createLink()
Look up a row for the specified resource.
public
createLink(string $resource, string $tag[, string $user = null ][, string $list = null ][, string $posted = null ]) : void
Parameters
- $resource : string
-
ID of resource to link up
- $tag : string
-
ID of tag to link up
- $user : string = null
-
ID of user creating link (optional but recommended)
- $list : string = null
-
ID of list to link up (optional)
- $posted : string = null
-
Posted date (optional -- omit for current)
Tags
Return values
void —createRow()
Create a new row.
public
createRow() : object
Return values
object —deduplicate()
Deduplicate rows (sometimes necessary after merging foreign key IDs).
public
deduplicate() : void
Return values
void —deleteByIdArray()
Delete a group of tags.
public
deleteByIdArray(array<string|int, mixed> $ids) : int
Parameters
- $ids : array<string|int, mixed>
-
IDs of tags to delete.
Return values
int —Count of $ids
destroyListLinks()
Unlink rows for the specified user list.
public
destroyListLinks(string $list, string $user[, string|array<string|int, mixed> $tag = null ]) : void
Parameters
- $list : string
-
ID of list to unlink
- $user : string
-
ID of user removing links
- $tag : string|array<string|int, mixed> = null
-
ID or array of IDs of tag(s) to unlink (null for ALL matching tags)
Tags
Return values
void —destroyResourceLinks()
Unlink rows for the specified resource.
public
destroyResourceLinks(string|array<string|int, mixed> $resource, string $user[, string $list = null ][, string|array<string|int, mixed> $tag = null ]) : void
Parameters
- $resource : string|array<string|int, mixed>
-
ID (or array of IDs) of resource(s) to unlink (null for ALL matching resources)
- $user : string
-
ID of user removing links
- $list : string = null
-
ID of list to unlink (null for ALL matching tags, 'none' for tags not in a list, true for tags only found in a list)
- $tag : string|array<string|int, mixed> = null
-
ID or array of IDs of tag(s) to unlink (null for ALL matching tags)
Tags
Return values
void —getAnonymousCount()
Get count of anonymous tags
public
getAnonymousCount() : int
Return values
int —count
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
Return values
T —getDbServiceManager()
Get the service plugin manager. Throw an exception if it is missing.
public
getDbServiceManager() : PluginManager
Tags
Return values
PluginManager —getDbTable()
Get access to another table.
public
getDbTable(string $table) : Gateway
Parameters
- $table : string
-
Table name
Return values
Gateway —getDuplicates()
Get a list of duplicate rows (this sometimes happens after merging IDs, for example after a Summon resource ID changes).
public
getDuplicates() : mixed
Return values
mixed —getListsForTag()
Get lists associated with a particular tag.
public
getListsForTag(string|array<string|int, mixed>|null $tag[, string|array<string|int, mixed>|null $listId = null ][, bool $publicOnly = true ][, bool $andTags = true ][, bool|null $caseSensitive = null ]) : AbstractResultSet
Parameters
- $tag : string|array<string|int, mixed>|null
-
Tag to match (null for all)
- $listId : string|array<string|int, mixed>|null = null
-
List ID to retrieve (null for all)
- $publicOnly : bool = true
-
Whether to return only public lists
- $andTags : bool = true
-
Use AND operator when filtering by tag.
- $caseSensitive : bool|null = null
-
Should tags be case sensitive? (null to use configured default)
Return values
AbstractResultSet —getResourcesForTag()
Get resources associated with a particular tag.
public
getResourcesForTag(string $tag, string $userId[, string $listId = null ][, bool|null $caseSensitive = null ]) : AbstractResultSet
Parameters
- $tag : string
-
Tag to match
- $userId : string
-
ID of user owning favorite list
- $listId : string = null
-
ID of list to retrieve (null for all favorites)
- $caseSensitive : bool|null = null
-
Should tags be case sensitive? (null to use configured default)
Return values
AbstractResultSet —getResourceTags()
Get Resource Tags
public
getResourceTags([string $userId = null ][, string $resourceId = null ][, string $tagId = null ][, string $order = null ][, string $page = null ][, string $limit = 20 ][, bool|null $caseSensitive = null ]) : Paginator
Parameters
- $userId : string = null
-
ID of user
- $resourceId : string = null
-
ID of the resource
- $tagId : string = null
-
ID of the tag
- $order : string = null
-
The order in which to return the data
- $page : string = null
-
The page number to select
- $limit : string = 20
-
The number of items to fetch
- $caseSensitive : bool|null = null
-
Should tags be case sensitive? (null to use configured default)
Return values
Paginator —getStatistics()
Get statistics on use of tags.
public
getStatistics([bool $extended = false ][, bool|null $caseSensitiveTags = null ]) : array<string|int, mixed>
Parameters
- $extended : bool = false
-
Include extended (unique/anonymous) stats.
- $caseSensitiveTags : bool|null = null
-
Should we treat tags as case-sensitive? (null for configured behavior)
Return values
array<string|int, mixed> —getUniqueResources()
Gets unique resources from the table
public
getUniqueResources([string $userId = null ][, string $resourceId = null ][, string $tagId = null ]) : AbstractResultSet
Parameters
- $userId : string = null
-
ID of user
- $resourceId : string = null
-
ID of the resource
- $tagId : string = null
-
ID of the tag
Return values
AbstractResultSet —getUniqueTags()
Gets unique tags from the table
public
getUniqueTags([string $userId = null ][, string $resourceId = null ][, string $tagId = null ][, bool|null $caseSensitive = null ]) : AbstractResultSet
Parameters
- $userId : string = null
-
ID of user
- $resourceId : string = null
-
ID of the resource
- $tagId : string = null
-
ID of the tag
- $caseSensitive : bool|null = null
-
Should tags be case sensitive? (null to use configured default)
Return values
AbstractResultSet —getUniqueUsers()
Gets unique users from the table
public
getUniqueUsers([string $userId = null ][, string $resourceId = null ][, string $tagId = null ]) : AbstractResultSet
Parameters
- $userId : string = null
-
ID of user
- $resourceId : string = null
-
ID of the resource
- $tagId : string = null
-
ID of the tag
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
Return values
void —setDbServiceManager()
Set the service plugin manager.
public
setDbServiceManager(PluginManager $manager) : void
Parameters
- $manager : PluginManager
-
Plugin manager
Return values
void —formatTagOrder()
Given an array for sorting database results, make sure the tag field is sorted in a case-insensitive fashion.
protected
formatTagOrder(array<string|int, mixed> $order) : array<string|int, mixed>
Parameters
- $order : array<string|int, mixed>
-
Order settings
Return values
array<string|int, mixed> —processDestroyLinks()
Process link rows marked to be destroyed.
protected
processDestroyLinks(object $callback) : void
Parameters
- $callback : object
-
Callback function for selecting deleted rows.