Test Failed
Branch softDeleteActiveQueryTrait (21292c)
by Angel
04:46
created

CreditSearch::attributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace app\api\models;
4
5
use roaresearch\yii2\roa\ResourceSearch;
6
use yii\data\ActiveDataProvider;
7
8
class CreditSearch extends Credit implements ResourceSearch
9
{
10
    /**
11
     * @inhertidoc
12
     */
13
    protected $autogenerateInitialWorklog = false;
14
15
    /**
16
     * @inhertidoc
17
     */
18
    public function rules()
19
    {
20
        return [
21
            [['created_by'], 'integer'],
22
        ];
23
    }
24
25
    /**
26
     * @inhertidoc
27
     */
28
    public function search(
29
        array $params,
30
        ?string $formName = ''
31
    ): ?ActiveDataProvider {
32
        $this->load($params, $formName);
33
        if (!$this->validate()) {
34
            return null;
35
        }
36
37
        $class = get_parent_class();
38
        return new ActiveDataProvider([
39
            'query' => $class::find()->andFilterWhere([
40
                'created_by' => $this->created_by,
0 ignored issues
show
Bug Best Practice introduced by
The property created_by does not exist on app\api\models\CreditSearch. Since you implemented __get, consider adding a @property annotation.
Loading history...
41
            ])
42
        ]);
43
    }
44
}
45