RatingThread
extends RatingThread
in package
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
- #[Entity]
- #[Table]
- $name: 'cms_mod_base_rating_threads'
- #[TableAlias]
- 'ratingThread'
Table of Contents
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]
$count2
protected
int
$count2
= 0
Attributes
- #[Column]
- $name: 'count_2'
- $type: 'integer'
- $options: ['unsigned' => true, 'default' => 0]
$count3
protected
int
$count3
= 0
Attributes
- #[Column]
- $name: 'count_3'
- $type: 'integer'
- $options: ['unsigned' => true, 'default' => 0]
$count4
protected
int
$count4
= 0
Attributes
- #[Column]
- $name: 'count_4'
- $type: 'integer'
- $options: ['unsigned' => true, 'default' => 0]
$count5
protected
int
$count5
= 0
Attributes
- #[Column]
- $name: 'count_5'
- $type: 'integer'
- $options: ['unsigned' => true, 'default' => 0]
$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]
$ratingCount
protected
int
$ratingCount
= 0
Attributes
- #[Column]
- $name: 'rating_count'
- $type: 'integer'
- $options: ['unsigned' => true, 'default' => 0]
$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>getCount1()
public
getCount1() : int
Return values
intgetCount2()
public
getCount2() : int
Return values
intgetCount3()
public
getCount3() : int
Return values
intgetCount4()
public
getCount4() : int
Return values
intgetCount5()
public
getCount5() : int
Return values
intgetCounts()
Returns the array [1 => count1, ..., 5 => count5] for drawing the bar chart.
public
getCounts() : array<int, int>
Return values
array<int, int>getId()
public
getId() : int|null
Return values
int|nullgetRatingAvg()
public
getRatingAvg() : string
Return values
stringgetRatingCount()
public
getRatingCount() : int
Return values
intgetType()
public
getType() : ThreadType|null
Return values
ThreadType|nullisPersisted()
public
isPersisted() : bool
Return values
boolsetCount1()
public
setCount1(int $count1) : $this
Parameters
- $count1 : int
Return values
$thissetCount2()
public
setCount2(int $count2) : $this
Parameters
- $count2 : int
Return values
$thissetCount3()
public
setCount3(int $count3) : $this
Parameters
- $count3 : int
Return values
$thissetCount4()
public
setCount4(int $count4) : $this
Parameters
- $count4 : int
Return values
$thissetCount5()
public
setCount5(int $count5) : $this
Parameters
- $count5 : int
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetRatingAvg()
public
setRatingAvg(string $ratingAvg) : $this
Parameters
- $ratingAvg : string
Return values
$thissetRatingCount()
public
setRatingCount(int $ratingCount) : $this
Parameters
- $ratingCount : int
Return values
$thissetType()
public
setType(ThreadType|null $type) : $this
Parameters
- $type : ThreadType|null
Return values
$thisgetTraitsRecursive()
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>