Completed
Push — master ( 69ec8b...199d88 )
by Tõnis
02:10
created

BaseAnswer::getTexts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace dameter\abstracts\models;
4
5
use dameter\abstracts\interfaces\WithLanguageSettingInterface;
6
7
8
/**
9
 * Class BaseAnswer
10
 * @property integer $answer_id
11
 * @property integer $question_id
12
 * @property integer $survey_id
13
 *
14
 * @property   BaseQuestion $question
15
 *
16
 * @package dameter\abstracts\models
17
 * @author Tõnis Ormisson <[email protected]>
18
 */
19
class BaseAnswer extends WithSurveyModel implements WithLanguageSettingInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function rules()
25
    {
26
        return array_merge(parent::rules(), [
27
            [['question_id', 'code'], 'required'],
28
            [['question_id'], 'integer'],
29
            [['code'], 'string', 'max' => 64],
30
        ]);
31
    }
32
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function getQuestion()
38
    {
39
        return $this->hasOne(BaseQuestion::class);
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function getTexts()
46
    {
47
        return $this->hasMany(AnswerText::class);
48
    }
49
50
}