Passed
Push — master ( ac87c4...6bb7b9 )
by Angel
04:29
created

m170101_000004_workflow_transition_permission   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 13
c 2
b 1
f 0
dl 0
loc 44
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A foreignKeys() 0 8 1
A getTableName() 0 3 1
A columns() 0 6 1
A compositePrimaryKeys() 0 3 1
1
<?php
2
3
use roaresearch\yii2\rmdb\migrations\CreateEntity;
4
5
class m170101_000004_workflow_transition_permission extends CreateEntity
6
{
7
    /**
8
     * @inhertidoc
9
     */
10
    public function getTableName(): string
11
    {
12
        return 'workflow_transition_permission';
13
    }
14
15
    /**
16
     * @inhertidoc
17
     */
18
    public function columns(): array
19
    {
20
        return [
21
            'source_stage_id' => $this->normalKey(),
22
            'target_stage_id' => $this->normalKey(),
23
            'permission' => $this->string()->notNull(),
24
        ];
25
    }
26
27
    /**
28
     * @inhertidoc
29
     */
30
    public function foreignKeys(): array
31
    {
32
        return [
33
            'transition' => [
34
                'table' => 'workflow_transition',
35
                'columns' => [
36
                    'source_stage_id' => 'source_stage_id',
37
                    'target_stage_id' => 'target_stage_id',
38
                ]
39
            ],
40
        ];
41
    }
42
43
    /**
44
     * @inhertidoc
45
     */
46
    public function compositePrimaryKeys(): array
47
    {
48
        return ['source_stage_id', 'target_stage_id', 'permission'];
49
    }
50
}
51