ArticleCategory::behaviors()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
namespace App\Model;
3
4
use App\Behavior\ArticleCategoryBehavior;
5
use App\Behavior\CreatorBehavior;
6
use App\Behavior\TimestampBehavior;
7
use Yii;
8
9
/**
10
 * This is the model class for table "{{%article_category}}".
11
 *
12
 * @property int $id
13
 * @property int $creator Creator ID
14
 * @property string $name Name
15
 * @property int $create_time Create Time
16
 * @property int $update_time Update Time
17
 */
18
class ArticleCategory extends ActiveRecord
19
{
20
    public function behaviors()
21
    {
22
        return [
23
            TimestampBehavior::class,
24
            CreatorBehavior::class,
25
            ArticleCategoryBehavior::class,
26
        ];
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public static function tableName()
33
    {
34
        return '{{%article_category}}';
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function rules()
41
    {
42
        return [
43
            [['name'], 'required'],
44
            [['create_time', 'update_time'], 'integer'],
45
            [['name'], 'string', 'max' => 32],
46
        ];
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function attributeLabels()
53
    {
54
        return [
55
            'id' => Yii::t('app', 'ID'),
56
            'creator' => Yii::t('app', 'Creator'),
57
            'name' => Yii::t('app', 'Name'),
58
            'create_time' => Yii::t('app', 'Create Time'),
59
            'update_time' => Yii::t('app', 'Update Time'),
60
        ];
61
    }
62
63
    public function fields()
64
    {
65
        return [
66
            'id',
67
            'name',
68
            'create_time',
69
            'update_time',
70
        ];
71
    }
72
}
73