Completed
Push — master ( 74c9a9...1153e3 )
by Andrii
11:57 queued 07:40
created

ConfigProfileController::actions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 10
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace hipanel\modules\server\controllers;
4
5
use hipanel\actions\ComboSearchAction;
6
use hipanel\actions\SearchAction;
7
use hipanel\base\CrudController;
8
use yii\base\Event;
9
10
class ConfigProfileController extends CrudController
11
{
12
    /** {@inheritdoc} */
13
    public function actions()
14
    {
15
        return array_merge(parent::actions(), [
16
            'search' => [
17
                'class' => ComboSearchAction::class,
18
                'on beforePerform' => function (Event $event) {
19
                    /** @var SearchAction $action */
20
                    $action = $event->sender;
21
                    $dataProvider = $action->getDataProvider();
22
                    $dataProvider->query->andWhere(['hide_default' => true]);
23
                },
24
            ],
25
        ]);
26
    }
27
}
28