VuFind API Documentation

CommentsServiceInterface extends DbServiceInterface

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

Table of Contents

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).
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.

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

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