@@ -120,12 +120,12 @@ |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | - * @param $mini_model |
|
124 | - * @param string $method_on_target |
|
125 | - * @param bool $is_EO_target |
|
126 | - * @param bool $is_EM_target |
|
127 | - * @throws \Throwable |
|
128 | - */ |
|
123 | + * @param $mini_model |
|
124 | + * @param string $method_on_target |
|
125 | + * @param bool $is_EO_target |
|
126 | + * @param bool $is_EM_target |
|
127 | + * @throws \Throwable |
|
128 | + */ |
|
129 | 129 | public function updateRelationWithSync($mini_model, string $method_on_target, $is_EO_target, $is_EM_target) |
130 | 130 | { |
131 | 131 | if ($is_EM_target) { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | $is_embeds_has_to_be_updated = $request->has($key); |
63 | 63 | |
64 | - if (! is_null($value) && ! ($value == '') && ! ($value == '[]')) { |
|
64 | + if (!is_null($value) && !($value == '') && !($value == '[]')) { |
|
65 | 65 | $objs = json_decode($value); |
66 | 66 | } else { |
67 | 67 | $objs = getArrayWithEmptyObj($model, $is_EO, $is_EM); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | - if (! empty($objs)) { |
|
84 | + if (!empty($objs)) { |
|
85 | 85 | if ($is_EM) { |
86 | 86 | $this->tempEM = []; |
87 | 87 | } |
@@ -133,19 +133,19 @@ discard block |
||
133 | 133 | throw_if( |
134 | 134 | !isset($this->$method_on_target), |
135 | 135 | new Exception( |
136 | - 'Error during target update. Remember to init the attribute ' . $method_on_target . |
|
137 | - ' on collection ' . $this->getCollection() |
|
136 | + 'Error during target update. Remember to init the attribute '.$method_on_target. |
|
137 | + ' on collection '.$this->getCollection() |
|
138 | 138 | ) |
139 | 139 | ); |
140 | 140 | foreach ($this->$method_on_target as $temp) { |
141 | 141 | throw_if( |
142 | 142 | is_array($temp), |
143 | 143 | new Exception( |
144 | - 'Error during target update. Remember to declare ' . $method_on_target . ' as ' . |
|
145 | - 'EmbedsMany relationship on model ' . get_class($this) |
|
144 | + 'Error during target update. Remember to declare '.$method_on_target.' as '. |
|
145 | + 'EmbedsMany relationship on model '.get_class($this) |
|
146 | 146 | ) |
147 | 147 | ); |
148 | - if (! is_null($temp)) { |
|
148 | + if (!is_null($temp)) { |
|
149 | 149 | $new_values[] = $temp->attributes; |
150 | 150 | } |
151 | 151 | } |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | throw_if( |
155 | 155 | is_array($mini_model), |
156 | 156 | new Exception( |
157 | - 'Error during target update. Remember to declare ' . $method_on_target . ' as ' . |
|
158 | - 'EmbedOne relationship on model ' . get_class($this) |
|
157 | + 'Error during target update. Remember to declare '.$method_on_target.' as '. |
|
158 | + 'EmbedOne relationship on model '.get_class($this) |
|
159 | 159 | ) |
160 | 160 | ); |
161 | 161 | $new_values = $mini_model->attributes; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | { |
211 | 211 | if ($is_EO) { |
212 | 212 | $embedObj = $this->$method; |
213 | - if (! is_null($embedObj)) { |
|
213 | + if (!is_null($embedObj)) { |
|
214 | 214 | $target_id = $embedObj->ref_id; |
215 | 215 | $this->handleSubTarget($target_id, $modelTarget, $methodOnTarget, $is_EO_target, $is_EM_target); |
216 | 216 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | if ($is_EM_target) { |
234 | 234 | $target = new $modelTarget; |
235 | 235 | $target = $target->all()->where('id', $target_id)->first(); |
236 | - if (! is_null($target)) { |
|
236 | + if (!is_null($target)) { |
|
237 | 237 | $new_values = []; |
238 | 238 | foreach ($target->$methodOnTarget as $temp) { |
239 | 239 | if ($temp->ref_id !== $this->getId()) { |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $EOitems = $embedObj->getItems(); |
271 | 271 | //Current Obj Create |
272 | 272 | foreach ($EOitems as $EOkey => $item) { |
273 | - if (! is_null($obj)) { |
|
273 | + if (!is_null($obj)) { |
|
274 | 274 | $is_ML = isML($item); |
275 | 275 | $is_MD = isMD($item); |
276 | 276 | $this->checkPropertyExistence($obj, $EOkey, $method, $model); |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | private function processEmbedOnTargetCollection($modelTarget, $obj, $methodOnTarget, $modelOnTarget, bool $is_EO_target, bool $is_EM_target) |
321 | 321 | { |
322 | 322 | $modelToBeSync = $this->getModelTobeSync($modelTarget, $obj); |
323 | - if (! is_null($modelToBeSync)) { |
|
323 | + if (!is_null($modelToBeSync)) { |
|
324 | 324 | $miniModel = $this->getEmbedModel($modelOnTarget); |
325 | 325 | $modelToBeSync->updateRelationWithSync($miniModel, $methodOnTarget, $is_EO_target, $is_EM_target); |
326 | 326 | //TODO:Sync target on level > 1 |