VoteAggregate::rules()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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