indexAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * Class Shopware_Controllers_Backend_DneCustomJsCss
5
 */
6
class Shopware_Controllers_Backend_DneCustomJsCss extends Shopware_Controllers_Backend_ExtJs
0 ignored issues
show
Bug introduced by
The type Shopware_Controllers_Backend_ExtJs was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
{
8
    public function indexAction()
9
    {
10
        $this->View()->loadTemplate('backend/dne_custom_js_css/app.js');
11
    }
12
13
    public function listAction()
14
    {
15
        $id = (int) $this->Request()->getParam('id', null);
16
17
        $qb = $this->getModelManager()->getDBALQueryBuilder();
18
        $qb->select(
19
                ['*']
20
            )
21
            ->from('dne_custom_js_css')
22
            ->orderBy('name', 'asc');
23
24
        if ((!empty($id))) {
25
            $qb->where('id = :id')->setParameter('id', $id);
26
        }
27
28
        $data = $qb->execute()->fetchAll();
29
30
        foreach ($data as &$row) {
31
            $row['shopIds'] = explode(',', $row['shopIds']);
32
        }
33
34
        $this->View()->assign(
35
            ['success' => true, 'data' => $data]
36
        );
37
    }
38
39
    public function createAction()
40
    {
41
        $params = $this->Request()->getPost();
42
43
        $params['shopIds'] = implode(',', $params['shopIds']);
44
45
        $this->getModelManager()->getConnection()->insert(
46
            'dne_custom_js_css',
47
            $params
48
        );
49
50
        $lastInsertId = $this->getModelManager()->getConnection()->lastInsertId();
51
52
        $this->View()->assign(
53
            [
54
                'success' => true,
55
                'id' => $lastInsertId,
56
            ]
57
        );
58
    }
59
60
    public function updateAction()
61
    {
62
        $params = $this->Request()->getPost();
63
        $id = (int) $this->Request()->get('id');
64
65
        $params['shopIds'] = implode(',', $params['shopIds']);
66
67
        $this->getModelManager()->getConnection()->update(
68
            'dne_custom_js_css',
69
            $params,
70
            ['id' => $id]
71
        );
72
73
        $this->View()->assign(
74
            ['success' => true]
75
        );
76
    }
77
78
    public function deleteAction()
79
    {
80
        $id = (int) $this->Request()->get('id');
81
82
        $this->getModelManager()->getConnection()->delete(
83
            'dne_custom_js_css',
84
            ['id' => $id]
85
        );
86
87
        $this->View()->assign(
88
            ['success' => true]
89
        );
90
    }
91
}
92