Passed
Push — master ( 2183b6...ac87c4 )
by Angel
05:00
created

WorkflowResource::actions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace roaresearch\yii2\workflow\roa\resources;
4
5
use roaresearch\yii2\roa\{actions\SoftDelete, controllers\Resource};
6
use roaresearch\yii2\workflow\roa\models\{Workflow, WorkflowSearch};
7
8
/**
9
 * Resource to handle `Workflow` records
10
 *
11
 * @author Angel (Faryshta) Guevara <[email protected]>
12
 */
13
class WorkflowResource extends Resource
14
{
15
    /**
16
     * @inheritdoc
17
     */
18
    public $modelClass = Workflow::class;
19
20
    /**
21
     * @inheritdoc
22
     */
23
    public $searchClass = WorkflowSearch::class;
24
25
    /**
26
     * @inheritdoc
27
     */
28 5
    public function actions()
29
    {
30 5
        $actions = parent::actions();
31 5
        $actions['delete']['class'] = SoftDelete::class;
32
33 5
        return $actions;
34
    }
35
36
    /**
37
     * @inheritdoc
38
     */
39 3
    public function baseQuery(): \yii\db\ActiveQuery
40
    {
41 3
        return parent::baseQuery()->notDeleted();
42
    }
43
}
44