1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace hauntd\vote\models; |
4
|
|
|
|
5
|
|
|
use Yii; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* This is the model class for table "vote_aggregate". |
9
|
|
|
* |
10
|
|
|
* @author Alexander Kononenko <[email protected]> |
11
|
|
|
* @package hauntd\vote\models |
12
|
|
|
* @property integer $id |
13
|
|
|
* @property integer $entity |
14
|
|
|
* @property integer $target_id |
15
|
|
|
* @property integer $positive |
16
|
|
|
* @property integer $negative |
17
|
|
|
* @property float $rating |
18
|
|
|
*/ |
19
|
|
|
class VoteAggregate extends \yii\db\ActiveRecord |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @return string |
23
|
|
|
*/ |
24
|
|
|
public static function tableName() |
25
|
|
|
{ |
26
|
|
|
return '{{%vote_aggregate}}'; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @return array |
31
|
|
|
*/ |
32
|
|
|
public function rules() |
33
|
|
|
{ |
34
|
|
|
return [ |
35
|
|
|
[['entity', 'target_id', 'positive', 'negative', 'rating'], 'required'], |
36
|
|
|
[['entity', 'target_id', 'positive', 'negative'], 'integer'], |
37
|
|
|
[['rating'], 'number'] |
38
|
|
|
]; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @return array |
43
|
|
|
*/ |
44
|
|
|
public function attributeLabels() |
45
|
|
|
{ |
46
|
|
|
return [ |
47
|
|
|
'id' => Yii::t('vote', 'ID'), |
48
|
|
|
'entity' => Yii::t('vote', 'Entity'), |
49
|
|
|
'target_id' => Yii::t('vote', 'Target Model ID'), |
50
|
|
|
'positive' => Yii::t('vote', 'Positive'), |
51
|
|
|
'negative' => Yii::t('vote', 'Negative'), |
52
|
|
|
'rating' => Yii::t('vote', 'Rating'), |
53
|
|
|
]; |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|