@@ -237,13 +237,15 @@ |
||
| 237 | 237 | $oldAttributes = $this->cleanAttributes($this->getOldAttributes()); |
| 238 | 238 | |
| 239 | 239 | // ensure to handle serialized attributes properly |
| 240 | - foreach($newAttributes as $key => $value) |
|
| 241 | - if(is_array($newAttributes[$key])) |
|
| 240 | + foreach($newAttributes as $key => $value) { |
|
| 241 | + if(is_array($newAttributes[$key])) |
|
| 242 | 242 | $newAttributes[$key] = Json::encode($newAttributes[$key]); |
| 243 | + } |
|
| 243 | 244 | |
| 244 | - foreach($oldAttributes as $key => $value) |
|
| 245 | - if(is_array($oldAttributes[$key])) |
|
| 245 | + foreach($oldAttributes as $key => $value) { |
|
| 246 | + if(is_array($oldAttributes[$key])) |
|
| 246 | 247 | $oldAttributes[$key] = Json::encode($oldAttributes[$key]); |
| 248 | + } |
|
| 247 | 249 | |
| 248 | 250 | // If no difference then get out of here |
| 249 | 251 | if (count(array_diff_assoc($newAttributes, $oldAttributes)) <= 0) { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | protected function cleanAttributesIgnored($attributes) |
| 182 | 182 | { |
| 183 | - if(is_array($this->timestamp_fields) && count($this->timestamp_fields) > 0) { |
|
| 183 | + if (is_array($this->timestamp_fields) && count($this->timestamp_fields) > 0) { |
|
| 184 | 184 | $this->ignored = array_merge($this->ignored, $this->timestamp_fields); |
| 185 | 185 | } |
| 186 | 186 | |
@@ -202,12 +202,12 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | protected function cleanAttributesOverride($attributes) |
| 204 | 204 | { |
| 205 | - if (sizeof($this->override) > 0 && sizeof($attributes) >0) { |
|
| 205 | + if (sizeof($this->override) > 0 && sizeof($attributes) > 0) { |
|
| 206 | 206 | foreach ($this->override as $field => $queryParams) { |
| 207 | 207 | $newOverrideValues = $this->getNewOverrideValues($attributes[$field], $queryParams); |
| 208 | 208 | $saveField = \yii\helpers\ArrayHelper::getValue($queryParams, 'saveField', $field); |
| 209 | 209 | |
| 210 | - if (count($newOverrideValues) >1) { |
|
| 210 | + if (count($newOverrideValues) > 1) { |
|
| 211 | 211 | $attributes[$saveField] = implode(', ', |
| 212 | 212 | \yii\helpers\ArrayHelper::map($newOverrideValues, $queryParams['returnField'], $queryParams['returnField']) |
| 213 | 213 | ); |
@@ -249,12 +249,12 @@ discard block |
||
| 249 | 249 | $oldAttributes = $this->cleanAttributes($this->getOldAttributes()); |
| 250 | 250 | |
| 251 | 251 | // ensure to handle serialized attributes properly |
| 252 | - foreach($newAttributes as $key => $value) |
|
| 253 | - if(is_array($newAttributes[$key])) |
|
| 252 | + foreach ($newAttributes as $key => $value) |
|
| 253 | + if (is_array($newAttributes[$key])) |
|
| 254 | 254 | $newAttributes[$key] = Json::encode($newAttributes[$key]); |
| 255 | 255 | |
| 256 | - foreach($oldAttributes as $key => $value) |
|
| 257 | - if(is_array($oldAttributes[$key])) |
|
| 256 | + foreach ($oldAttributes as $key => $value) |
|
| 257 | + if (is_array($oldAttributes[$key])) |
|
| 258 | 258 | $oldAttributes[$key] = Json::encode($oldAttributes[$key]); |
| 259 | 259 | |
| 260 | 260 | // If no difference then get out of here |