Test Failed
Pull Request — master (#3)
by Angel
04:04
created

WorkflowResource   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 30
rs 10
c 2
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A baseQuery() 0 4 1
A actions() 0 6 1
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
use yii\db\ActiveQuery;
8
9
/**
10
 * Resource to handle `Workflow` records
11
 *
12
 * @author Angel (Faryshta) Guevara <[email protected]>
13
 */
14
class WorkflowResource extends Resource
15
{
16
    /**
17
     * @inheritdoc
18
     */
19
    public $modelClass = Workflow::class;
20
21
    /**
22
     * @inheritdoc
23
     */
24
    public $searchClass = WorkflowSearch::class;
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function actions()
30
    {
31
        $actions = parent::actions();
32
        $actions['delete']['class'] = SoftDelete::class;
33
34
        return $actions;
35
    }
36
37
    /**
38
     * @inheritdoc
39
     */
40
    public function baseQuery(): ActiveQuery
41
    {
42
        return parent::baseQuery()
43
            ->andWhere(['deleted_at' => null, 'deleted_by' => null]);
44
    }
45
}
46