@@ -24,13 +24,15 @@ 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 | |
| 31 | 32 | $extra_data = json_decode($this->request->getContent(), true)['extra-data'] ?? null; |
| 32 | - if (!$extra_data) |
|
| 33 | - return; |
|
| 33 | + if (!$extra_data) { |
|
| 34 | + return; |
|
| 35 | + } |
|
| 34 | 36 | |
| 35 | 37 | //$this->manager->persist($entity); |
| 36 | 38 | //$this->manager->flush(); |
@@ -41,11 +43,13 @@ discard block |
||
| 41 | 43 | } |
| 42 | 44 | private function persistData($entity_id, $entity_name) |
| 43 | 45 | { |
| 44 | - if (!$entity_id || !$entity_name) |
|
| 45 | - return; |
|
| 46 | + if (!$entity_id || !$entity_name) { |
|
| 47 | + return; |
|
| 48 | + } |
|
| 46 | 49 | $extra_data = json_decode($this->request->getContent(), true)['extra-data'] ?? null; |
| 47 | - if (!$extra_data) |
|
| 48 | - return; |
|
| 50 | + if (!$extra_data) { |
|
| 51 | + return; |
|
| 52 | + } |
|
| 49 | 53 | |
| 50 | 54 | |
| 51 | 55 | foreach ($extra_data['data'] as $key => $data) { |
@@ -57,8 +61,9 @@ discard block |
||
| 57 | 61 | 'extra_fields' => $extra_fields |
| 58 | 62 | ]); |
| 59 | 63 | |
| 60 | - if (!$extraData) |
|
| 61 | - $extraData = new ExtraData(); |
|
| 64 | + if (!$extraData) { |
|
| 65 | + $extraData = new ExtraData(); |
|
| 66 | + } |
|
| 62 | 67 | |
| 63 | 68 | $extraData->setExtraFields($extra_fields); |
| 64 | 69 | $extraData->setEntityName($entity_name); |
@@ -73,13 +78,15 @@ discard block |
||
| 73 | 78 | |
| 74 | 79 | public function noChange() |
| 75 | 80 | { |
| 76 | - if (self::$persisted == true) |
|
| 77 | - return; |
|
| 81 | + if (self::$persisted == true) { |
|
| 82 | + return; |
|
| 83 | + } |
|
| 78 | 84 | self::$persisted = true; |
| 79 | 85 | |
| 80 | 86 | $extra_data = json_decode($this->request->getContent(), true)['extra-data'] ?: null; |
| 81 | - if (!$extra_data) |
|
| 82 | - return; |
|
| 87 | + if (!$extra_data) { |
|
| 88 | + return; |
|
| 89 | + } |
|
| 83 | 90 | |
| 84 | 91 | $this->persistData($extra_data['entity_id'], $extra_data['entity_name']); |
| 85 | 92 | } |