ScreenHasFlow::rules()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace app\models;
4
5
use Yii;
6
7
/**
8
 * This is the model class for table "screen_has_flow".
9
 *
10
 * @property integer $screen_id
11
 * @property integer $flow_id
12
 *
13
 * @property Screen $screen
14
 * @property Flow $flow
15
 */
16 View Code Duplication
class ScreenHasFlow extends \yii\db\ActiveRecord
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    /**
19
     * @inheritdoc
20
     */
21
    public static function tableName()
22
    {
23
        return 'screen_has_flow';
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function rules()
30
    {
31
        return [
32
            [['screen_id', 'flow_id'], 'required'],
33
            [['screen_id', 'flow_id'], 'integer'],
34
            [['screen_id'], 'exist', 'skipOnError' => true, 'targetClass' => Screen::class, 'targetAttribute' => ['screen_id' => 'id']],
35
            [['flow_id'], 'exist', 'skipOnError' => true, 'targetClass' => Flow::class, 'targetAttribute' => ['flow_id' => 'id']],
36
        ];
37
    }
38
39
    /**
40
     * @inheritdoc
41
     */
42
    public function attributeLabels()
43
    {
44
        return [
45
            'screen_id' => Yii::t('app', 'Screen ID'),
46
            'flow_id' => Yii::t('app', 'Flow ID'),
47
        ];
48
    }
49
50
    /**
51
     * @return \yii\db\ActiveQuery
52
     */
53
    public function getScreen()
54
    {
55
        return $this->hasOne(Screen::class, ['id' => 'screen_id']);
56
    }
57
58
    /**
59
     * @return \yii\db\ActiveQuery
60
     */
61
    public function getFlow()
62
    {
63
        return $this->hasOne(Flow::class, ['id' => 'flow_id']);
64
    }
65
}
66