Passed
Push — master ( cc5012...08c5ef )
by Andrea
20:25 queued 48s
created

OpzioniTabellaController::createAction()   B

Complexity

Conditions 4
Paths 4

Size

Total Lines 50
Code Lines 34

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
dl 0
loc 50
ccs 0
cts 34
cp 0
rs 8.8571
c 0
b 0
f 0
cc 4
eloc 34
nc 4
nop 1
crap 20
1
<?php
2
3
/* Qui Bundle */
4
//namespace Fi\DemoBundle\Controller;
5
6
namespace Fi\CoreBundle\Controller;
7
8
use Symfony\Component\HttpFoundation\Request;
9
use Symfony\Component\HttpFoundation\Response;
10
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
11
12
/**
13
 * OpzioniTabella controller.
14
 */
15
class OpzioniTabellaController extends FiCoreController
16
{
17
18
    /**
19
     * Lists all opzioniTabella entities.
20
     */
21 1
    public function indexAction(Request $request)
22
    {
23
        /* @var $em \Doctrine\ORM\EntityManager */
24 1
        $this->setup($request);
25 1
        $namespace = $this->getNamespace();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
26 1
        $bundle = $this->getBundle();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
27 1
        $controller = $this->getController();
28 1
        $container = $this->container;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
29
30 1
        $nomebundle = $namespace . $bundle . 'Bundle';
31
32
        $dettaglij = array(
33
            'descrizione' => array(
34
                array(
35 1
                    'nomecampo' => 'descrizione',
36 1
                    'lunghezza' => '400',
37 1
                    'descrizione' => 'Descrizione',
38 1
                    'tipo' => 'text',),),
39
            'parametro' => array(
40
                array(
41 1
                    'nomecampo' => 'parametro',
42 1
                    'lunghezza' => '300',
43 1
                    'descrizione' => 'Parametro',
44 1
                    'tipo' => 'text',),),
45
            'valore' => array(
46
                array(
47 1
                    'nomecampo' => 'valore',
48 1
                    'lunghezza' => '300',
49 1
                    'descrizione' => 'Valore',
50 1
                    'tipo' => 'text',),),
51
            'tabelle_id' => array(
52
                array(
53 1
                    'nomecampo' => 'tabelle.nometabella',
54 1
                    'lunghezza' => '400',
55 1
                    'descrizione' => 'Tabella',
56 1
                    'tipo' => 'text',),
57 1
            ),
58 1
        );
59
60 1
        $escludi = array();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
61
        $paricevuti = array(
62 1
            'nomebundle' => $nomebundle,
63 1
            'nometabella' => $controller,
64 1
            'dettaglij' => $dettaglij,
65 1
            'escludere' => $escludi,
66 1
            'container' => $container,
67 1
        );
68
69 1
        $testatagriglia = Griglia::testataPerGriglia($paricevuti);
70
71 1
        $testatagriglia['multisearch'] = 1;
72 1
        $testatagriglia['showconfig'] = 1;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
73 1
        $testatagriglia['showadd'] = 1;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
74 1
        $testatagriglia['showedit'] = 1;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
75 1
        $testatagriglia['showdel'] = 1;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
76 1
        $testatagriglia['editinline'] = 0;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
77
78 1
        $testatagriglia['parametritesta'] = json_encode($paricevuti);
79 1
        $this->setParametriGriglia(array('request' => $request));
80 1
        $testatagriglia['parametrigriglia'] = json_encode(self::$parametrigriglia);
81
82 1
        $testata = json_encode($testatagriglia);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
83
        $twigparms = array(
84 1
            'nomecontroller' => $controller,
85 1
            'testata' => $testata,
86 1
        );
87
88 1
        return $this->render($nomebundle . ':' . $controller . ':index.html.twig', $twigparms);
89
    }
90
91 1
    public function setParametriGriglia($prepar = array())
92
    {
93 1
        $this->setup($prepar['request']);
94 1
        $namespace = $this->getNamespace();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
95 1
        $bundle = $this->getBundle();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
96 1
        $controller = $this->getController();
97
98 1
        $nomebundle = $namespace . $bundle . 'Bundle';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 13 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
99 1
        $escludi = array();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 16 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
100 1
        $tabellej = array();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 15 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
101 1
        $tabellej['tabelle_id'] = array('tabella' => 'tabelle', 'campi' => array('nometabella'));
102
103
        $paricevuti = array(
104 1
            'container' => $this->container,
105 1
            'nomebundle' => $nomebundle,
106 1
            'tabellej' => $tabellej,
107 1
            'nometabella' => $controller,
108 1
            'escludere' => $escludi,);
109
110 1
        if (!empty($prepar)) {
111 1
            $paricevuti = array_merge($paricevuti, $prepar);
112 1
        }
113
114 1
        self::$parametrigriglia = $paricevuti;
115 1
    }
116
117
    /**
118
     * Creates a new table entity.
119
     */
120
    public function createAction(Request $request)
121
    {
122
        $this->setup($request);
123
        $namespace = $this->getNamespace();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
124
        $bundle = $this->getBundle();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
125
        $controller = $this->getController();
126
127
        if (!self::$canCreate) {
128
            throw new AccessDeniedException("Non si hanno i permessi per creare questo contenuto");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal Non si hanno i permessi ...creare questo contenuto does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
129
        }
130
131
        $nomebundle = $namespace . $bundle . 'Bundle';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
132
        $classbundle = $namespace . '\\' . $bundle . 'Bundle' . '\\Entity\\' . $controller;
133
        $formbundle = $namespace . '\\' . $bundle . 'Bundle' . '\\Form\\' . $controller;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
134
135
        $entity = new $classbundle();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
136
        $formType = $formbundle . 'Type';
137
138
        $form = $this->createForm(
139
            $formType,
140
            $entity,
141
            array('attr' => array(
142
                'id' => 'formdati' . $controller,
143
                ),
144
                'action' => $this->generateUrl($controller . '_create'),
145
                )
146
        );
147
148
        $form->submit($request->request->get($form->getName()));
149
150
        if ($form->isValid()) {
151
            $em = $this->getDoctrine()->getManager();
152
            $em->persist($entity);
153
            $em->flush();
154
            $em->getConfiguration()->getResultCacheImpl()->delete("opzionitabella");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal opzionitabella does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
155
156
            $continua = (int) $request->get('continua');
157
            if ($continua === 0) {
158
                return new Response('OK');
159
            } else {
160
                return $this->redirect($this->generateUrl($controller . '_edit', array('id' => $entity->getId())));
161
            }
162
        }
163
164
        return $this->render(
165
            $nomebundle . ':' . $controller . ':new.html.twig',
166
            array(
167
                    'nomecontroller' => $controller,
168
                    'entity' => $entity,
169
                    'form' => $form->createView(),
170
                        )
171
        );
172
    }
173
174
    /**
175
     * Edits an existing table entity.
176
     */
177
    public function updateAction(Request $request, $id)
178
    {
179
        /* @var $em \Doctrine\ORM\EntityManager */
180
        $this->setup($request);
181
        $namespace = $this->getNamespace();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
182
        $bundle = $this->getBundle();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
183
        $controller = $this->getController();
184
185
        if (!self::$canUpdate) {
186
            throw new AccessDeniedException("Non si hanno i permessi per aggiornare questo contenuto");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal Non si hanno i permessi ...ornare questo contenuto does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
187
        }
188
189
        $nomebundle = $namespace . $bundle . 'Bundle';
190
        $formbundle = $namespace . '\\' . $bundle . 'Bundle' . '\\Form\\' . $controller;
191
        $formType = $formbundle . 'Type';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
192
193
        $repoStorico = $this->container->get('Storicomodifiche_repository');
194
195
        $em = $this->getDoctrine()->getManager();
196
197
        $entity = $em->getRepository($nomebundle . ':' . $controller)->find($id);
198
199
        if (!$entity) {
200
            throw $this->createNotFoundException('Unable to find ' . $controller . ' entity.');
201
        }
202
203
        $deleteForm = $this->createDeleteForm($id);
204
205
        $editForm = $this->createForm(
206
            $formType,
207
            $entity,
208
            array('attr' => array(
209
                'id' => 'formdati' . $controller,
210
                ),
211
                'action' => $this->generateUrl($controller . '_update', array('id' => $entity->getId())),
212
                )
213
        );
214
215
        $editForm->submit($request->request->get($editForm->getName()));
216
217
        if ($editForm->isValid()) {
218
            $originalData = $em->getUnitOfWork()->getOriginalEntityData($entity);
219
220
            $em->persist($entity);
221
            $em->flush();
222
            $em->getConfiguration()->getResultCacheImpl()->delete("opzionitabella");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal opzionitabella does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
223
224
            $newData = $em->getUnitOfWork()->getOriginalEntityData($entity);
225
            $changes = $repoStorico->isRecordChanged($nomebundle, $controller, $originalData, $newData);
226
227
            if ($changes) {
228
                $repoStorico->saveHistory($controller, $changes, $id, $this->getUser());
229
            }
230
231
            $continua = (int) $request->get('continua');
232
            if ($continua === 0) {
233
                return new Response('OK');
234
            } else {
235
                return $this->redirect($this->generateUrl($controller . '_edit', array('id' => $id)));
236
            }
237
        }
238
239
        return $this->render(
240
            $nomebundle . ':' . $controller . ':edit.html.twig',
241
            array(
242
                    'entity' => $entity,
243
                    'edit_form' => $editForm->createView(),
244
                    'delete_form' => $deleteForm->createView(),
245
                    'nomecontroller' => $controller,
246
                        )
247
        );
248
    }
249
250
    /**
251
     * Deletes a table entity.
252
     */
253
    public function deleteAction(Request $request)
254
    {
255
        /* @var $em \Doctrine\ORM\EntityManager */
256
        $this->setup($request);
257
        if (!self::$canDelete) {
258
            throw new AccessDeniedException("Non si hanno i permessi per aggiornare questo contenuto");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal Non si hanno i permessi ...ornare questo contenuto does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
259
        }
260
        $namespace = $this->getNamespace();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
261
        $bundle = $this->getBundle();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
262
        $controller = $this->getController();
263
264
        $nomebundle = $namespace . $bundle . 'Bundle';
265
266
        try {
267
            $em = $this->getDoctrine()->getManager();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
268
            $qb = $em->createQueryBuilder();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
269
            $ids = explode(',', $request->get('id'));
270
            $qb->delete($nomebundle . ':' . $controller, 'u')
271
                    ->andWhere('u.id IN (:ids)')
272
                    ->setParameter('ids', $ids);
273
274
            $query = $qb->getQuery();
275
            $query->execute();
276
            $em->getConfiguration()->getResultCacheImpl()->delete("opzionitabella");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal opzionitabella does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
277
        } catch (\Exception $e) {
278
            $response = new Response();
279
            $response->setStatusCode('200');
280
281
            return new Response('404');
282
        }
283
284
        return new Response('OK');
285
    }
286
}
287