m170101_000003_workflow_transition   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 47
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A compositeUniqueKeys() 0 3 1
A compositePrimaryKeys() 0 3 1
A columns() 0 6 1
A foreignKeys() 0 5 1
A getTableName() 0 3 1
1
<?php
2
3
use roaresearch\yii2\rmdb\migrations\CreateEntity;
4
5
class m170101_000003_workflow_transition extends CreateEntity
6
{
7
    /**
8
     * @inhertidoc
9
     */
10
    public function getTableName(): string
11
    {
12
        return 'workflow_transition';
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
            'name' => $this->string(64)->notNull(),
24
        ];
25
    }
26
27
    /**
28
     * @inhertidoc
29
     */
30
    public function foreignKeys(): array
31
    {
32
        return [
33
            'source_stage_id' => 'workflow_stage',
34
            'target_stage_id' => 'workflow_stage',
35
        ];
36
    }
37
38
    /**
39
     * @inhertidoc
40
     */
41
    public function compositePrimaryKeys(): array
42
    {
43
        return ['source_stage_id', 'target_stage_id'];
44
    }
45
46
    /**
47
     * @inhertidoc
48
     */
49
    public function compositeUniqueKeys(): array
50
    {
51
        return [['source_stage_id', 'name']];
52
    }
53
}
54