SmartDeleteAction   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 25
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A loadCollection() 0 8 2
A getDefaultRules() 0 12 1
1
<?php
2
/**
3
 * HiPanel core package
4
 *
5
 * @link      https://hipanel.com/
6
 * @package   hipanel-core
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2014-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\actions;
12
13
use Yii;
14
15
/**
16
 * Class SmartDeleteAction.
17
 */
18
class SmartDeleteAction extends SmartPerformAction
19
{
20
    public function loadCollection($data = null)
21
    {
22
        // Fixes delete buttons in GridView.
23
        // When button in being pressed, the system submits POST request which contains
24
        // POST model ClassSearch and GET attribute with ID
25
        $data = Yii::$app->request->get() ? [Yii::$app->request->get()] : null;
26
        parent::loadCollection($data);
27
    }
28
29
    /** {@inheritdoc} */
30
    protected function getDefaultRules()
31
    {
32
        return array_merge([
33
            'POST html | POST pjax' => [
34
                'save'    => true,
35
                'success' => [
36
                    'class' => RedirectAction::class,
37
                    'url'   => 'index',
38
                ],
39
            ],
40
        ], parent::getDefaultRules());
41
    }
42
}
43