VuFind API Documentation

RatingsService extends AbstractDbService
in package
implements DbTableAwareInterface, RatingsServiceInterface Uses DbTableAwareTrait

Database service for Ratings.

Tags
category

VuFind

author

Sudharma Kellampalli skellamp@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
RatingsServiceInterface
Database service interface for Ratings.

Table of Contents

$tableManager  : PluginManager
Database table plugin manager
addOrUpdateRating()  : int
Add or update user's rating for a resource.
deleteByUser()  : void
Deletes all ratings by a user.
getCountsForRecord()  : array<string|int, mixed>
Get rating breakdown for the specified record.
getDbTable()  : Gateway
Get a database table object.
getDbTableManager()  : PluginManager
Get the table plugin manager. Throw an exception if it is missing.
getRecordRatings()  : array<string|int, mixed>
Get average rating and rating count associated with the specified record.
getStatistics()  : array<string|int, mixed>
Get statistics on use of Ratings.
persistEntity()  : void
Persist an entity.
setDbTableManager()  : void
Set the table plugin manager.

Properties

Methods

getCountsForRecord()

Get rating breakdown for the specified record.

public getCountsForRecord(string $id, string $source, array<string|int, mixed> $groups) : array<string|int, mixed>
Parameters
$id : string

Record ID to look up

$source : string

Source of record to look up

$groups : array<string|int, mixed>

Group definition (key => [min, max])

Return values
array<string|int, mixed>

Array with keys count and rating (between 0 and 100) as well as an groups array with ratings from lowest to highest

getDbTable()

Get a database table object.

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

Table to load.

Return values
Gateway

getRecordRatings()

Get average rating and rating count associated with the specified record.

public getRecordRatings(string $id, string $source, int|null $userId) : array<string|int, mixed>
Parameters
$id : string

Record ID to look up

$source : string

Source of record to look up

$userId : int|null

User ID, or null for all users

Return values
array<string|int, mixed>

Array with keys count and rating (between 0 and 100)

getStatistics()

Get statistics on use of Ratings.

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

Search results