VuFind API Documentation

CommentsService extends AbstractDbService
in package
implements CommentsServiceInterface, DbServiceAwareInterface, DbTableAwareInterface Uses DbServiceAwareTrait, DbTableAwareTrait

Database service for Comments.

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

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

Table of Contents

$dbServiceManager  : PluginManager
Database service plugin manager
$tableManager  : PluginManager
Database table plugin manager
addComment()  : int|null
Add a comment to the current resource. Returns comment ID on success, null on failure.
changeResourceId()  : void
Change all matching comments to use the new resource ID instead of the old one (called when an ID changes).
createEntity()  : CommentsEntityInterface
Create a comments entity object.
deleteByUser()  : void
Deletes all comments by a user.
deleteIfOwnedByUser()  : bool
Delete a comment if the owner is logged in. Returns true on success.
getCommentById()  : CommentsEntityInterface|null
Get a comment row by ID (or return null for no match).
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.
getRecordComments()  : array<string|int, CommentsEntityInterface>
Get comments associated with the specified record.
getStatistics()  : array<string|int, mixed>
Get statistics on use of comments.
persistEntity()  : void
Persist an entity.
setDbServiceManager()  : void
Set the service plugin manager.
setDbTableManager()  : void
Set the table plugin manager.

Properties

Methods

changeResourceId()

Change all matching comments 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

deleteIfOwnedByUser()

Delete a comment if the owner is logged in. Returns true on success.

public deleteIfOwnedByUser(int $id, UserEntityInterface|int $userOrId) : bool
Parameters
$id : int

ID of row to delete

$userOrId : UserEntityInterface|int

User object or identifier

Return values
bool

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

getRecordComments()

Get comments associated with the specified record.

public getRecordComments(string $id[, string $source = DEFAULT_SEARCH_BACKEND ]) : array<string|int, CommentsEntityInterface>
Parameters
$id : string

Record ID to look up

$source : string = DEFAULT_SEARCH_BACKEND

Source of record to look up

Return values
array<string|int, CommentsEntityInterface>

getStatistics()

Get statistics on use of comments.

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

Search results