CoolCMS API

Rating extends Rating
in package

Admin variant of a rating (`cms_mod_base_ratings`), hydrated from the `api/base/rating` endpoint.

Used to moderate the ratings of a thread (stars, text, pros, cons, operator reply, approval, soft delete).

IMPORTANT: it does not map an association to the thread. The column cms_mod_base_rating_threads_rating_thread_id is already mapped by the scalar threadId, and Doctrine does not allow a second writable mapping of the same column (JoinColumn has no insertable/updatable in this version). The overview therefore resolves the section itself through a threadId => type map (RatingPresenter).

Attributes
#[Entity]
#[Table]
$name: 'cms_mod_base_ratings'
#[TableAlias]
'rating'

Table of Contents

Properties

$active  : bool
$approved  : bool
$approvedDatetime  : DateTime|null
$cons  : array<int, string>|null
$deleted  : bool
$id  : int|null
$insertDatetime  : DateTime
$ip  : string
$pros  : array<int, string>|null
$reports  : int
$response  : string|null
$responseDatetime  : DateTime|null
$text  : string|null
$threadId  : int
$userId  : int|null
$userName  : string|null
$value  : int
$votesDown  : int
$votesUp  : int

Methods

__construct()  : mixed
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getActive()  : bool
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getApproved()  : bool
getApprovedDatetime()  : DateTime|null
getCons()  : array<int, string>
getDeleted()  : bool
getId()  : int|null
getInsertDatetime()  : DateTime
getIp()  : string
getOwnerUserId()  : int|null
Returns the id of the user who created the record; `null` for an unknown or anonymous owner.
getPros()  : array<int, string>
getReports()  : int
getResponse()  : string|null
getResponseDatetime()  : DateTime|null
getText()  : string|null
getThreadId()  : int
getUserId()  : int|null
getUserName()  : string|null
getValue()  : int
getVotesDown()  : int
getVotesUp()  : int
isActive()  : bool
isApproved()  : bool
isDeleted()  : bool
isPersisted()  : bool
isReported()  : bool
Was the review reported at least once? (admin filter)
isReview()  : bool
Does the rating have a verbal part (text/pros/cons), not only stars?
setApproved()  : $this
setApprovedDatetime()  : $this
setCons()  : $this
setDeleted()  : $this
setId()  : $this
setInsertDatetime()  : $this
setIp()  : $this
setPros()  : $this
setReports()  : $this
setResponse()  : $this
setResponseDatetime()  : $this
setText()  : $this
setThreadId()  : $this
setUserId()  : $this
setUserName()  : $this
setValue()  : $this
setVotesDown()  : $this
setVotesUp()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$active

protected bool $active = false
Attributes
#[Column]
$name: 'active'
$type: 'boolean'
$nullable: false
$insertable: false
$updatable: false
$options: ['default' => 0]
#[FieldAccess]
$read: Audience::All
$insert: Audience::Privileged
$update: Audience::Privileged

$approved

protected bool $approved = false
Attributes
#[Column]
$name: 'approved'
$type: 'boolean'
#[ExternalReadonly]

$approvedDatetime

protected DateTime|null $approvedDatetime = null
Attributes
#[Column]
$name: 'approved_datetime'
$type: 'datetime'
$nullable: true
#[ExternalReadonly]

$cons

protected array<int, string>|null $cons = null

cons (verbal variant only)

Attributes
#[Column]
$name: 'cons'
$type: 'json'
$nullable: true

$deleted

protected bool $deleted = false
Attributes
#[Column]
$name: 'deleted'
$type: 'boolean'
#[ExternalReadonly]

$id

protected int|null $id = null
Attributes
#[Column]
$type: 'integer'
$name: 'rating_id'
$options: ['unsigned' => true]
#[GeneratedValue]
#[Id]

$insertDatetime

protected DateTime $insertDatetime = new DateTime()
Attributes
#[Column]
$name: 'insert_datetime'
$type: 'datetime'
#[ExternalReadonly]

$pros

protected array<int, string>|null $pros = null

pros (verbal variant only)

Attributes
#[Column]
$name: 'pros'
$type: 'json'
$nullable: true

$reports

protected int $reports = 0
Attributes
#[Column]
$name: 'reports'
$type: 'integer'
$options: ['unsigned' => true, 'default' => 0]
#[ExternalReadonly]

$response

protected string|null $response = null
Attributes
#[Column]
$name: 'response'
$type: 'text'
$nullable: true
#[ExternalReadonly]

$responseDatetime

protected DateTime|null $responseDatetime = null
Attributes
#[Column]
$name: 'response_datetime'
$type: 'datetime'
$nullable: true
#[ExternalReadonly]

$text

protected string|null $text = null
Attributes
#[Column]
$name: 'text'
$type: 'text'
$nullable: true

$threadId

protected int $threadId = 0
Attributes
#[Column]
$type: 'integer'
$name: 'cms_mod_base_rating_threads_rating_thread_id'
$options: ['unsigned' => true]
#[FieldAccess]
$read: Audience::All
$insert: Audience::All
$update: Audience::Privileged

$userId

protected int|null $userId = null
Attributes
#[Column]
$type: 'integer'
$name: 'cms_system_users_user_id'
$nullable: true
$options: ['unsigned' => true]
#[ExternalReadonly]

$userName

protected string|null $userName = null
Attributes
#[Column]
$name: 'user_name'
$type: 'string'
$length: 255
$nullable: true

$value

protected int $value = 0
Attributes
#[Column]
$name: 'value'
$type: 'smallint'
$options: ['unsigned' => true, 'default' => 0]

$votesDown

protected int $votesDown = 0
Attributes
#[Column]
$name: 'votes_down'
$type: 'integer'
$options: ['unsigned' => true, 'default' => 0]
#[ExternalReadonly]

$votesUp

protected int $votesUp = 0
Attributes
#[Column]
$name: 'votes_up'
$type: 'integer'
$options: ['unsigned' => true, 'default' => 0]
#[ExternalReadonly]

Methods

__construct()

public __construct([int|null $id = null ][, int $threadId = 0 ][, int $value = 0 ][, string|null $text = null ][, array<string|int, mixed>|null $pros = null ][, array<string|int, mixed>|null $cons = null ][, string|null $response = null ][, DateTime|null $responseDatetime = null ][, int|null $userId = null ][, string|null $userName = null ][, string $ip = '' ][, bool $approved = false ][, DateTime|null $approvedDatetime = null ][, bool $deleted = false ][, DateTime $insertDatetime = new DateTime() ][, bool $active = false ][, int $votesUp = 0 ][, int $votesDown = 0 ][, int $reports = 0 ]) : mixed
Parameters
$id : int|null = null
$threadId : int = 0
$value : int = 0
$text : string|null = null
$pros : array<string|int, mixed>|null = null
$cons : array<string|int, mixed>|null = null
$response : string|null = null
$responseDatetime : DateTime|null = null
$userId : int|null = null
$userName : string|null = null
$ip : string = ''
$approved : bool = false
$approvedDatetime : DateTime|null = null
$deleted : bool = false
$insertDatetime : DateTime = new DateTime()
$active : bool = false
$votesUp : int = 0
$votesDown : int = 0
$reports : int = 0

callInitMethods()

Calls `init{TraitName}()` for every used trait that defines such a method.

public callInitMethods() : void

getActive()

public getActive() : bool
Return values
bool

getAllTraits()

Returns all traits the class uses, including those used by parent classes and nested traits.

public getAllTraits() : array<string, string>
Return values
array<string, string>

getApproved()

public getApproved() : bool
Return values
bool

getApprovedDatetime()

public getApprovedDatetime() : DateTime|null
Return values
DateTime|null

getCons()

public getCons() : array<int, string>
Return values
array<int, string>

getDeleted()

public getDeleted() : bool
Return values
bool

getInsertDatetime()

public getInsertDatetime() : DateTime
Return values
DateTime

getIp()

public getIp() : string
Return values
string

getOwnerUserId()

Returns the id of the user who created the record; `null` for an unknown or anonymous owner.

public getOwnerUserId() : int|null
Return values
int|null

getPros()

public getPros() : array<int, string>
Return values
array<int, string>

getReports()

public getReports() : int
Return values
int

getResponse()

public getResponse() : string|null
Return values
string|null

getResponseDatetime()

public getResponseDatetime() : DateTime|null
Return values
DateTime|null

getText()

public getText() : string|null
Return values
string|null

getThreadId()

public getThreadId() : int
Return values
int

getUserId()

public getUserId() : int|null
Return values
int|null

getUserName()

public getUserName() : string|null
Return values
string|null

getValue()

public getValue() : int
Return values
int

getVotesDown()

public getVotesDown() : int
Return values
int

getVotesUp()

public getVotesUp() : int
Return values
int

isActive()

public isActive() : bool
Return values
bool

isApproved()

public isApproved() : bool
Return values
bool

isDeleted()

public isDeleted() : bool
Return values
bool

isReported()

Was the review reported at least once? (admin filter)

public isReported() : bool
Return values
bool

isReview()

Does the rating have a verbal part (text/pros/cons), not only stars?

public isReview() : bool
Return values
bool

setApproved()

public setApproved(bool $approved) : $this
Parameters
$approved : bool
Return values
$this

setApprovedDatetime()

public setApprovedDatetime(DateTime|null $approvedDatetime) : $this
Parameters
$approvedDatetime : DateTime|null
Return values
$this

setCons()

public setCons(array<int, string>|null $cons) : $this
Parameters
$cons : array<int, string>|null
Return values
$this

setDeleted()

public setDeleted(bool $deleted) : $this
Parameters
$deleted : bool
Return values
$this

setId()

public setId(int|null $id) : $this
Parameters
$id : int|null
Return values
$this

setInsertDatetime()

public setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
$insertDatetime : DateTime
Return values
$this

setIp()

public setIp(string $ip) : $this
Parameters
$ip : string
Return values
$this

setPros()

public setPros(array<int, string>|null $pros) : $this
Parameters
$pros : array<int, string>|null
Return values
$this

setReports()

public setReports(int $reports) : $this
Parameters
$reports : int
Return values
$this

setResponse()

public setResponse(string|null $response) : $this
Parameters
$response : string|null
Return values
$this

setResponseDatetime()

public setResponseDatetime(DateTime|null $responseDatetime) : $this
Parameters
$responseDatetime : DateTime|null
Return values
$this

setText()

public setText(string|null $text) : $this
Parameters
$text : string|null
Return values
$this

setThreadId()

public setThreadId(int $threadId) : $this
Parameters
$threadId : int
Return values
$this

setUserId()

public setUserId(int|null $userId) : $this
Parameters
$userId : int|null
Return values
$this

setUserName()

public setUserName(string|null $userName) : $this
Parameters
$userName : string|null
Return values
$this

setValue()

public setValue(int $value) : $this
Parameters
$value : int
Return values
$this

setVotesDown()

public setVotesDown(int $votesDown) : $this
Parameters
$votesDown : int
Return values
$this

setVotesUp()

public setVotesUp(int $votesUp) : $this
Parameters
$votesUp : int
Return values
$this

getTraitsRecursive()

Walks the trait list recursively and collects nested traits too.

private static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
$traits : array<string, string>
Return values
array<string, string>
On this page

Search results