@@ -43,14 +43,16 @@ discard block |
||
43 | 43 | |
44 | 44 | public function discoveryUser(&$entity) |
45 | 45 | { |
46 | - if (method_exists($entity, 'setUser')) |
|
47 | - $entity->setUser($this->security->getUser()); |
|
46 | + if (method_exists($entity, 'setUser')) { |
|
47 | + $entity->setUser($this->security->getUser()); |
|
48 | + } |
|
48 | 49 | } |
49 | 50 | |
50 | 51 | public function persist(&$entity) |
51 | 52 | { |
52 | - if (self::$persisted == true) |
|
53 | - return; |
|
53 | + if (self::$persisted == true) { |
|
54 | + return; |
|
55 | + } |
|
54 | 56 | self::$persisted = true; |
55 | 57 | |
56 | 58 | //$this->manager->persist($entity); |
@@ -68,15 +70,17 @@ discard block |
||
68 | 70 | } else { |
69 | 71 | $json = json_decode($this->request->getContent(), true); |
70 | 72 | $extra_data = isset($json['extra-data']) ? $json['extra-data'] : null; |
71 | - if (!$extra_data) |
|
72 | - return; |
|
73 | + if (!$extra_data) { |
|
74 | + return; |
|
75 | + } |
|
73 | 76 | $entity_id = $extra_data['entity_id']; |
74 | 77 | $entity_name = $extra_data['entity_name']; |
75 | 78 | } |
76 | 79 | |
77 | 80 | |
78 | - if (!$entity_id || !$entity_name) |
|
79 | - return; |
|
81 | + if (!$entity_id || !$entity_name) { |
|
82 | + return; |
|
83 | + } |
|
80 | 84 | |
81 | 85 | foreach ($extra_data['data'] as $key => $data) { |
82 | 86 | $extra_fields = $this->manager->getRepository(ExtraFields::class)->find($key); |
@@ -87,8 +91,9 @@ discard block |
||
87 | 91 | 'extra_fields' => $extra_fields |
88 | 92 | ]); |
89 | 93 | |
90 | - if (!$extraData) |
|
91 | - $extraData = new ExtraData(); |
|
94 | + if (!$extraData) { |
|
95 | + $extraData = new ExtraData(); |
|
96 | + } |
|
92 | 97 | |
93 | 98 | $extraData->setExtraFields($extra_fields); |
94 | 99 | $extraData->setEntityName($entity_name); |
@@ -45,8 +45,9 @@ |
||
45 | 45 | { |
46 | 46 | $device = $this->discoveryDevice($deviceId); |
47 | 47 | $device_config = $this->discoveryDeviceConfig($device, $people); |
48 | - foreach ($configs as $key => $config) |
|
49 | - $device_config->addConfigs($key, $config); |
|
48 | + foreach ($configs as $key => $config) { |
|
49 | + $device_config->addConfigs($key, $config); |
|
50 | + } |
|
50 | 51 | |
51 | 52 | $this->manager->persist($device_config); |
52 | 53 | $this->manager->flush(); |