Passed
Push — master ( 9884ea...4ce3b8 )
by Tõnis
02:09
created

Quota::tableName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace dameter\abstracts\models;
4
5
use dameter\abstracts\WithLanguageSettingsModel;
6
7
8
/**
9
 * Class Quota
10
 * @property integer $quota_id
11
 * @property integer $type_id
12
 *
13
 * @property QuotaText[] $endMessages
14
 * @property QuotaText[] $endUrls
15
 *
16
 * @package dameter\abstract\models
17
 * @author Tõnis Ormisson <[email protected]>
18
 */
19
class Quota extends WithLanguageSettingsModel
20
{
21
    public static $settingsClass = QuotaText::class;
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public static function tableName()
27
    {
28
        return "quota";
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public static function primaryKey()
35
    {
36
        return ["quota_id"];
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function rules()
43
    {
44
        return array_merge(parent::rules(), [
45
        ]);
46
    }
47
48
    /**
49
     * @return \yii\db\ActiveQuery
50
     */
51
    public function getEndMessages()
52
    {
53
        $query = $this->getTexts();
54
        return $query->andWhere(['type_id' => QuotaText::TYPE_END_MESSAGE]);
55
    }
56
57
    /**
58
     * @return \yii\db\ActiveQuery
59
     */
60
    public function getEndUrls()
61
    {
62
        $query = $this->getTexts();
63
        return $query->andWhere(['type_id' => QuotaText::TYPE_END_URL]);
64
    }
65
66
67
}