@@ -24,8 +24,9 @@ discard block |
||
24 | 24 | } |
25 | 25 | public function persist($entity) |
26 | 26 | { |
27 | - if (self::$persisted == true) |
|
28 | - return; |
|
27 | + if (self::$persisted == true) { |
|
28 | + return; |
|
29 | + } |
|
29 | 30 | self::$persisted = true; |
30 | 31 | $this->manager->persist($entity); |
31 | 32 | //$this->manager->flush(); |
@@ -36,11 +37,13 @@ discard block |
||
36 | 37 | } |
37 | 38 | public function persistData($entity_id, $entity_name) |
38 | 39 | { |
39 | - if (!$entity_id || !$entity_name) |
|
40 | - return; |
|
40 | + if (!$entity_id || !$entity_name) { |
|
41 | + return; |
|
42 | + } |
|
41 | 43 | $extra_data = json_decode($this->request->getContent(), true)['extra-data'] ?? null; |
42 | - if (!$extra_data) |
|
43 | - return; |
|
44 | + if (!$extra_data) { |
|
45 | + return; |
|
46 | + } |
|
44 | 47 | |
45 | 48 | |
46 | 49 | foreach ($extra_data['data'] as $key => $data) { |
@@ -52,8 +55,9 @@ discard block |
||
52 | 55 | 'extra_fields' => $extra_fields |
53 | 56 | ]); |
54 | 57 | |
55 | - if (!$extraData) |
|
56 | - $extraData = new ExtraData(); |
|
58 | + if (!$extraData) { |
|
59 | + $extraData = new ExtraData(); |
|
60 | + } |
|
57 | 61 | |
58 | 62 | $extraData->setExtraFields($extra_fields); |
59 | 63 | $extraData->setEntityName($entity_name); |
@@ -68,13 +72,15 @@ discard block |
||
68 | 72 | |
69 | 73 | public function noChange() |
70 | 74 | { |
71 | - if (self::$persisted == true) |
|
72 | - return; |
|
75 | + if (self::$persisted == true) { |
|
76 | + return; |
|
77 | + } |
|
73 | 78 | self::$persisted = true; |
74 | 79 | |
75 | 80 | $extra_data = json_decode($this->request->getContent(), true)['extra-data'] ?: null; |
76 | - if (!$extra_data) |
|
77 | - return; |
|
81 | + if (!$extra_data) { |
|
82 | + return; |
|
83 | + } |
|
78 | 84 | |
79 | 85 | $this->persistData($extra_data['entity_id'], $extra_data['entity_name']); |
80 | 86 | } |