CoolCMS API

RatingThread extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait

AbstractYes

Anchor and aggregate of ratings per object (modeled after {@see CommentThread}).

type lives on the thread (the thread itself does not know its section) for admin moderation and per-type configuration. ratingCount/ratingAvg are maintained by RatingManager per thread, recomputed from active rows (cron only self-heals). Deleting a thread cascades to its ratings.

Attributes
#[MappedSuperclass]
#[TableAlias]
$alias: 'ratingThread'

Table of Contents

Interfaces

IdentifiableInterface
Entity with a simple integer primary key. Most entities have one (often via {@see \App\Core\Traits\Shared\Models\Entities\IdentifiableTrait}); texts and links with a composite key do not, which is why `getId()` is not on {@see \App\Core\Base\BaseEntity}. Code that needs the id of a generic entity asks for this interface (parameter type, template bound, `instanceof`).

Properties

$count1  : int
$count2  : int
$count3  : int
$count4  : int
$count5  : int
$id  : int|null
$ratingAvg  : string
$ratingCount  : int
$type  : ThreadType|null

Methods

__construct()  : mixed
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getCount1()  : int
getCount2()  : int
getCount3()  : int
getCount4()  : int
getCount5()  : int
getCounts()  : array<int, int>
Returns the array [1 => count1, ..., 5 => count5] for drawing the bar chart.
getId()  : int|null
getRatingAvg()  : string
getRatingCount()  : int
getType()  : ThreadType|null
isPersisted()  : bool
setCount1()  : $this
setCount2()  : $this
setCount3()  : $this
setCount4()  : $this
setCount5()  : $this
setId()  : $this
setRatingAvg()  : $this
setRatingCount()  : $this
setType()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$count1

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

$count2

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

$count3

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

$count4

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

$count5

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

$id

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

$ratingAvg

protected string $ratingAvg = '0.00'
Attributes
#[Column]
$name: 'rating_avg'
$type: 'decimal'
$precision: 3
$scale: 2
$options: ['default' => 0]
#[ExternalReadonly]

$ratingCount

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

$type

protected ThreadType|null $type = null
Attributes
#[Column]
$name: 'type'
$type: 'string'
$length: 32
$enumType: ThreadType::class

Methods

__construct()

public __construct([int|null $id = null ][, ThreadType|null $type = null ][, int $ratingCount = 0 ][, string $ratingAvg = '0.00' ][, int $count1 = 0 ][, int $count2 = 0 ][, int $count3 = 0 ][, int $count4 = 0 ][, int $count5 = 0 ]) : mixed
Parameters
$id : int|null = null
$type : ThreadType|null = null
$ratingCount : int = 0
$ratingAvg : string = '0.00'
$count1 : int = 0
$count2 : int = 0
$count3 : int = 0
$count4 : int = 0
$count5 : int = 0

callInitMethods()

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

public callInitMethods() : void

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>

getCounts()

Returns the array [1 => count1, ..., 5 => count5] for drawing the bar chart.

public getCounts() : array<int, int>
Return values
array<int, int>

getRatingAvg()

public getRatingAvg() : string
Return values
string

getRatingCount()

public getRatingCount() : int
Return values
int

setCount1()

public setCount1(int $count1) : $this
Parameters
$count1 : int
Return values
$this

setCount2()

public setCount2(int $count2) : $this
Parameters
$count2 : int
Return values
$this

setCount3()

public setCount3(int $count3) : $this
Parameters
$count3 : int
Return values
$this

setCount4()

public setCount4(int $count4) : $this
Parameters
$count4 : int
Return values
$this

setCount5()

public setCount5(int $count5) : $this
Parameters
$count5 : int
Return values
$this

setId()

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

setRatingAvg()

public setRatingAvg(string $ratingAvg) : $this
Parameters
$ratingAvg : string
Return values
$this

setRatingCount()

public setRatingCount(int $ratingCount) : $this
Parameters
$ratingCount : 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