Passed
Push — master ( e5a117...444e05 )
by Paweł
09:40
created

Category::attributeLabels()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
namespace app\models;
4
5
use Yii;
6
use yii\db\ActiveRecord;
7
8
/**
9
 * This is the model class for table "category".
10
 *
11
 * @property int $id
12
 * @property string $name
13
 *
14
 * @property AccountCategory[] $accountCategories
15
 */
16
class Category extends ActiveRecord
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public static function tableName()
22
    {
23
        return 'category';
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function rules()
30
    {
31
        return [
32
            [['name'], 'required'],
33
            [['name'], 'string', 'max' => 255],
34
            [['name'], 'unique'],
35
        ];
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function attributeLabels()
42
    {
43
        return [
44
            'id' => Yii::t('app', 'ID'),
45
            'name' => Yii::t('app', 'Name'),
46
        ];
47
    }
48
49
    /**
50
     * @return \yii\db\ActiveQuery
51
     */
52
    public function getAccountCategories()
53
    {
54
        return $this->hasMany(AccountCategory::class, ['category_id' => 'id']);
55
    }
56
}
57