CoolCMS API

RatingThreadCreatorTrait

Creates a rating thread ({@see RatingThread}) for an entity and links it through an FK column.

Use it in an Api manager whose entity can be rated (article, gallery, …): call createRatingThread() from afterSave on insert with the ThreadType of the section, so the object can be rated at once. type is required (it is kept on the thread for admin moderation and per-type configuration), so the consumer, who knows its section, passes it.

Tags
requires

$this->ratingThreadManager (RatingThreadManager, injected by the consumer)

SaveTrait providing updateColumn()

Table of Contents

Methods

createRatingThread()  : Result|null
Creates a new {@see RatingThread} of the given section and writes its id into `$column` of the entity `$entityId` (default `ratingThreadId`, a scalar FK; pass the association name for an association). Returns a failed {@see Result} (the caller may return it from `afterSave` to roll back), or null.

Methods

createRatingThread()

Creates a new {@see RatingThread} of the given section and writes its id into `$column` of the entity `$entityId` (default `ratingThreadId`, a scalar FK; pass the association name for an association). Returns a failed {@see Result} (the caller may return it from `afterSave` to roll back), or null.

protected createRatingThread(int|null $entityId, ThreadType $type[, string $column = 'ratingThreadId' ]) : Result|null
Parameters
$entityId : int|null
$type : ThreadType
$column : string = 'ratingThreadId'
Return values
Result|null
On this page

Search results