Passed
Push — neill-raw-html ( ee63ec...0aa5bd )
by Neill
16:50
created
neon/daedalus/services/ddsManager/DdsObjectManager.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			$query->andWhere('[[o]].[[_deleted]] = 0');
278 278
 		if ($inFull) {
279 279
 			$tableName = $this->getTableFromClassType($classType);
280
-			$query->innerJoin('{{' . $tableName . '}} t', '[[o]].[[_uuid]]=[[t]].[[_uuid]]');
280
+			$query->innerJoin('{{'.$tableName.'}} t', '[[o]].[[_uuid]]=[[t]].[[_uuid]]');
281 281
 		}
282 282
 
283 283
 		if (is_array($order)) {
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 		$object->_created = $now;
321 321
 		$object->_updated = $now;
322 322
 		if (!$object->save())
323
-			throw new \RuntimeException("Couldn't create object: " . print_r($object->errors, true));
323
+			throw new \RuntimeException("Couldn't create object: ".print_r($object->errors, true));
324 324
 
325 325
 		// increment the class's object count
326 326
 		$class->count_total += 1;
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 			}
346 346
 
347 347
 			if (count($fields))
348
-				$query = "INSERT INTO `$table` (`_uuid`, " . implode(', ', $fields) . ") VALUES ('{$object->_uuid}', " . implode(', ', $inserts) . ")";
348
+				$query = "INSERT INTO `$table` (`_uuid`, ".implode(', ', $fields).") VALUES ('{$object->_uuid}', ".implode(', ', $inserts).")";
349 349
 			else
350 350
 				$query = "INSERT INTO `$table` (`_uuid`) VALUES ('{$object->_uuid}')";
351 351
 			$command = neon()->db->createCommand($query);
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 			$table = $this->getTableFromClassType($object->_class_type);
434 434
 			$query = "SELECT `o`.*, `t`.* FROM `dds_object` `o` LEFT JOIN  `$table` `t` ON `o`.`_uuid`=`t`.`_uuid` WHERE `o`.`_uuid`=:uuid LIMIT 1";
435 435
 			$rows = neon()->db->createCommand($query)->bindValue(':uuid', $uuid)->queryAll();
436
-			$row =  count($rows) > 0 ? $rows[0] : null;
436
+			$row = count($rows) > 0 ? $rows[0] : null;
437 437
 			$this->convertFromDBToPHP($row, $this->getMemberLinks($uuid));
438 438
 			return $row;
439 439
 		}
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 			if (count($updates) == 0)
492 492
 				return false;
493 493
 
494
-			$query = "UPDATE `$table` SET " . implode(', ', $updates) . " WHERE `_uuid`='$uuid' LIMIT 1";
494
+			$query = "UPDATE `$table` SET ".implode(', ', $updates)." WHERE `_uuid`='$uuid' LIMIT 1";
495 495
 			neon()->db->createCommand($query)->bindValues($values)->execute();
496 496
 
497 497
 			// add or remove any links from the linking table
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 			$table = $this->getTableFromClassType($classType);
531 531
 			$memberStorage = $this->getMemberStorage($classType);
532 532
 			if (count($memberStorage) == 0) {
533
-				throw new \InvalidArgumentException('Unknown or empty class type ' . $classType);
533
+				throw new \InvalidArgumentException('Unknown or empty class type '.$classType);
534 534
 			}
535 535
 
536 536
 			// see if we are recording changes into the change log
@@ -573,14 +573,14 @@  discard block
 block discarded – undo
573 573
 				$objectValues[$placeHolder] = $id;
574 574
 				$count++;
575 575
 			}
576
-			$uuidClause = '(' . implode(',', $uuidClause) . ')';
576
+			$uuidClause = '('.implode(',', $uuidClause).')';
577 577
 
578 578
 			// update the latest changed
579 579
 			$db = neon()->db;
580
-			$query = "UPDATE `dds_object` SET `_updated`=NOW() WHERE `_uuid` IN $uuidClause LIMIT " . count($uuids);
580
+			$query = "UPDATE `dds_object` SET `_updated`=NOW() WHERE `_uuid` IN $uuidClause LIMIT ".count($uuids);
581 581
 			$db->createCommand($query)->bindValues($objectValues)->execute();
582 582
 			// make the changes
583
-			$query = "UPDATE `$table` SET " . implode(', ', $updates) . " WHERE `_uuid` IN $uuidClause LIMIT " . count($uuids);
583
+			$query = "UPDATE `$table` SET ".implode(', ', $updates)." WHERE `_uuid` IN $uuidClause LIMIT ".count($uuids);
584 584
 			$db->createCommand($query)->bindValues($values)->execute();
585 585
 
586 586
 			//
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 			$object->_deleted = 1;
612 612
 			$object->_updated = date('Y-m-d H:i:s');
613 613
 			if (!$object->save())
614
-				throw new \RuntimeException("Couldn't delete the object: " . print_r($object->errors, true));
614
+				throw new \RuntimeException("Couldn't delete the object: ".print_r($object->errors, true));
615 615
 			// and update the class object deleted count
616 616
 			$class = null;
617 617
 			$this->findClass($object['_class_type'], $class);
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 			$object->_deleted = 0;
700 700
 			$object->_updated = date('Y-m-d H:i:s');
701 701
 			if (!$object->save())
702
-				throw new \RuntimeException("Couldn't undelete the object: " . print_r($object->errors, true));
702
+				throw new \RuntimeException("Couldn't undelete the object: ".print_r($object->errors, true));
703 703
 
704 704
 			// and update the class object deleted count
705 705
 			$class = null;
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 	{
822 822
 		$row = DdsClass::find()->where(['class_type'=>$classType])->one()->toArray();
823 823
 		if ($row) {
824
-			return ['total'=>$row['count_total'], 'active'=>($row['count_total']-$row['count_deleted']), 'deleted'=>$row['count_deleted']];
824
+			return ['total'=>$row['count_total'], 'active'=>($row['count_total'] - $row['count_deleted']), 'deleted'=>$row['count_deleted']];
825 825
 		}
826 826
 		return null;
827 827
 	}
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 		static $counter = 0;
941 941
 		$counter++;
942 942
 		// a randomly generated resultKey prevents db query chaching.
943
-		$resultKey = $resultKey ? $resultKey : $request['requestKey'] . '_' . $counter;
943
+		$resultKey = $resultKey ? $resultKey : $request['requestKey'].'_'.$counter;
944 944
 		$request['resultKey'] = $resultKey;
945 945
 		if (!array_key_exists($request['requestKey'], self::$_requestResultsCache))
946 946
 			$this->convertRequestToSql($request);
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 				}
1027 1027
 				$request['totalSql'] .= ", '$request[requestKey]' as `{$this->requestKeyField}`, '$request[resultKey]_total' as `{$this->resultKeyField}` FROM `dds_class` WHERE `class_type` = '$classType'";
1028 1028
 			} else {
1029
-				$request['totalSql'] =  "SELECT COUNT(*) as `total`, '$request[requestKey]' as `{$this->requestKeyField}`, '$request[resultKey]_total' as `{$this->resultKeyField}` FROM $table t $join $where";
1029
+				$request['totalSql'] = "SELECT COUNT(*) as `total`, '$request[requestKey]' as `{$this->requestKeyField}`, '$request[resultKey]_total' as `{$this->resultKeyField}` FROM $table t $join $where";
1030 1030
 			}
1031 1031
 		}
1032 1032
 	}
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 					$clauseSql[] = $filter['filterSql'];
1149 1149
 					unset($filter['sql']);
1150 1150
 				}
1151
-				$filters['sql'] = '(' . implode(') OR (', $clauseSql) . ')';
1151
+				$filters['sql'] = '('.implode(') OR (', $clauseSql).')';
1152 1152
 			}
1153 1153
 			return;
1154 1154
 		}
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 		$filter = (in_array($filters[0], $links) ? "`link_{$filters[0]}`.`to_id`" : $this->quoteField($filters[0]));
1161 1161
 		$filterKeys[$filters[0]] = $filters[0];
1162 1162
 		if ($this->operatorTakesObject($filters[1]) && isset($filters[2]))
1163
-			$filters['itemSql'] = $filters['sql'] = "$filter " . $this->prepareForPDO($filters[1], $filters[2]);
1163
+			$filters['itemSql'] = $filters['sql'] = "$filter ".$this->prepareForPDO($filters[1], $filters[2]);
1164 1164
 		else {
1165 1165
 			$filters['itemSql'] = $filters['sql'] = "$filter $filters[1]";
1166 1166
 		}
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 				throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of values with an operator of $operator");
1175 1175
 			foreach ($value as $v) {
1176 1176
 				if (is_array($v))
1177
-					throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of *array* of values as filters (silly billy). You passed " . print_r($value, true));
1177
+					throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of *array* of values as filters (silly billy). You passed ".print_r($value, true));
1178 1178
 				$count = count($this->boundValues);
1179 1179
 				$variable = ":var{$count}end";
1180 1180
 				$this->boundValues[$variable] = $v;
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
 				$operator = 'IN';
1186 1186
 			if ($operator == '!=')
1187 1187
 				$operator = 'NOT IN';
1188
-			return "$operator (" . implode(',', $pdoValues) . ')';
1188
+			return "$operator (".implode(',', $pdoValues).')';
1189 1189
 		} else {
1190 1190
 			$count = count($this->boundValues);
1191 1191
 			$variable = ":var{$count}end";
@@ -1219,11 +1219,11 @@  discard block
 block discarded – undo
1219 1219
 			}
1220 1220
 			// allow negative ordering in mysql for nulls last
1221 1221
 			if (strpos($o, '-') === 0)
1222
-				$clause[] = '-' . substr($o, 1) . " $d";
1222
+				$clause[] = '-'.substr($o, 1)." $d";
1223 1223
 			else
1224 1224
 				$clause[] = "$o $d";
1225 1225
 		}
1226
-		return 'ORDER BY ' . implode(', ', $clause);
1226
+		return 'ORDER BY '.implode(', ', $clause);
1227 1227
 	}
1228 1228
 
1229 1229
 	/**
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 					// remove any empty toLinks that might have snuck through
1265 1265
 					$toLinks = array_filter($toLinks);
1266 1266
 					if (!$this->areUUIDs($toLinks))
1267
-						throw new \InvalidArgumentException("The toMemberLinks should be UUID64s. You passed in " . print_r($toLinks, true));
1267
+						throw new \InvalidArgumentException("The toMemberLinks should be UUID64s. You passed in ".print_r($toLinks, true));
1268 1268
 					$toLinks = array_unique($toLinks);
1269 1269
 
1270 1270
 					//
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 			$objectValues[$placeHolder] = $id;
1390 1390
 			$count++;
1391 1391
 		}
1392
-		$uuidClause = '(' . implode(',', $uuidClause) . ')';
1392
+		$uuidClause = '('.implode(',', $uuidClause).')';
1393 1393
 		$query = "SELECT [[_uuid]] FROM [[dds_object]] WHERE [[_class_type]]='$classType' AND [[_uuid]] IN $uuidClause";
1394 1394
 		$checkedUuidResults = $db->createCommand($query)->bindValues($objectValues)->queryAll();
1395 1395
 		return array_column($checkedUuidResults, '_uuid');
Please login to merge, or discard this patch.
Braces   +206 added lines, -142 removed lines patch added patch discarded remove patch
@@ -108,8 +108,9 @@  discard block
 block discarded – undo
108 108
 					// set null result information about the request
109 109
 					$newData[$k] = ['start' => $r['limit']['start'], 'length' => 0, 'total' => $r['total'], 'rows' => []];
110 110
 					$sql[] = $r['sql'];
111
-					if ($r['totalSql'])
112
-						$sql[] = $r['totalSql'];
111
+					if ($r['totalSql']) {
112
+											$sql[] = $r['totalSql'];
113
+					}
113 114
 					$resultKey2RequestKey[$r['resultKey']] = $r['requestKey'];
114 115
 				}
115 116
 			}
@@ -170,8 +171,9 @@  discard block
 block discarded – undo
170 171
 	 */
171 172
 	public function runSingleObjectRequest($classType, array $filters = [], array $order = [], array $limit = [], $includeDeleted = false)
172 173
 	{
173
-		if (empty($classType))
174
-			throw new \InvalidArgumentException('ClassType must be specified');
174
+		if (empty($classType)) {
175
+					throw new \InvalidArgumentException('ClassType must be specified');
176
+		}
175 177
 
176 178
 		// make sure that any currently queued requests from elsewhere are saved off the queue
177 179
 		$currentRequests = $this->popRequests();
@@ -254,16 +256,18 @@  discard block
 block discarded – undo
254 256
 	public function listObjects($classType, &$total = null, $includeDeleted = false, $inFull = true, $start = 0, $length = 100, $order = null)
255 257
 	{
256 258
 		$classType = $this->canonicaliseRef($classType);
257
-		if (empty($order))
258
-			$order = ['_created' => 'DESC'];
259
+		if (empty($order)) {
260
+					$order = ['_created' => 'DESC'];
261
+		}
259 262
 		$order = $this->canonicaliseOrder($order);
260 263
 
261 264
 		// get the total first
262 265
 		$class = null;
263 266
 		$this->findClass($classType, $class, true);
264 267
 		$total = $class->count_total;
265
-		if (!$includeDeleted)
266
-			$total -= $class->count_deleted;
268
+		if (!$includeDeleted) {
269
+					$total -= $class->count_deleted;
270
+		}
267 271
 
268 272
 		// now get the objects
269 273
 		$query = (new \neon\core\db\Query)
@@ -273,8 +277,9 @@  discard block
 block discarded – undo
273 277
 			->offset($start)
274 278
 			->limit($length);
275 279
 
276
-		if (!$includeDeleted)
277
-			$query->andWhere('[[o]].[[_deleted]] = 0');
280
+		if (!$includeDeleted) {
281
+					$query->andWhere('[[o]].[[_deleted]] = 0');
282
+		}
278 283
 		if ($inFull) {
279 284
 			$tableName = $this->getTableFromClassType($classType);
280 285
 			$query->innerJoin('{{' . $tableName . '}} t', '[[o]].[[_uuid]]=[[t]].[[_uuid]]');
@@ -289,8 +294,9 @@  discard block
 block discarded – undo
289 294
 					$orderBits[] = "[[t]].$k $d";
290 295
 				}
291 296
 			}
292
-			if ($orderBits)
293
-				$orderClause = implode(', ', $orderBits);
297
+			if ($orderBits) {
298
+							$orderClause = implode(', ', $orderBits);
299
+			}
294 300
 			$query->orderBy($orderClause);
295 301
 		}
296 302
 
@@ -307,8 +313,9 @@  discard block
 block discarded – undo
307 313
 		$class = null;
308 314
 		$classType = $this->canonicaliseRef($classType);
309 315
 		$this->findClass($classType, $class, true);
310
-		if ($class->hasChangeLog())
311
-			$newValues = $data;
316
+		if ($class->hasChangeLog()) {
317
+					$newValues = $data;
318
+		}
312 319
 		$table = $this->getTableFromClassType($classType);
313 320
 
314 321
 		// create the new object
@@ -319,8 +326,9 @@  discard block
 block discarded – undo
319 326
 		$object->_class_type = $classType;
320 327
 		$object->_created = $now;
321 328
 		$object->_updated = $now;
322
-		if (!$object->save())
323
-			throw new \RuntimeException("Couldn't create object: " . print_r($object->errors, true));
329
+		if (!$object->save()) {
330
+					throw new \RuntimeException("Couldn't create object: " . print_r($object->errors, true));
331
+		}
324 332
 
325 333
 		// increment the class's object count
326 334
 		$class->count_total += 1;
@@ -344,10 +352,11 @@  discard block
 block discarded – undo
344 352
 				}
345 353
 			}
346 354
 
347
-			if (count($fields))
348
-				$query = "INSERT INTO `$table` (`_uuid`, " . implode(', ', $fields) . ") VALUES ('{$object->_uuid}', " . implode(', ', $inserts) . ")";
349
-			else
350
-				$query = "INSERT INTO `$table` (`_uuid`) VALUES ('{$object->_uuid}')";
355
+			if (count($fields)) {
356
+							$query = "INSERT INTO `$table` (`_uuid`, " . implode(', ', $fields) . ") VALUES ('{$object->_uuid}', " . implode(', ', $inserts) . ")";
357
+			} else {
358
+							$query = "INSERT INTO `$table` (`_uuid`) VALUES ('{$object->_uuid}')";
359
+			}
351 360
 			$command = neon()->db->createCommand($query);
352 361
 			$command->bindValues($values);
353 362
 			$command->execute();
@@ -355,8 +364,9 @@  discard block
 block discarded – undo
355 364
 			// if there are any links then add these to the link table
356 365
 			$this->setMemberLinks($object->_uuid, $links);
357 366
 
358
-			if ($class->hasChangeLog())
359
-				$changeLogUuid = $this->createChangeLogEntry($class, 'ADD', $object->_uuid, [], $newValues);
367
+			if ($class->hasChangeLog()) {
368
+							$changeLogUuid = $this->createChangeLogEntry($class, 'ADD', $object->_uuid, [], $newValues);
369
+			}
360 370
 		} catch (\Exception $e) {
361 371
 			// execution failed so clean up the object
362 372
 			$object->delete();
@@ -400,8 +410,9 @@  discard block
 block discarded – undo
400 410
 			$objectsLinks = [];
401 411
 			$now = date('Y-m-d H:i:s');
402 412
 			foreach ($chunkData as $row) {
403
-				if ($hasChangeLog)
404
-					$newValues = $row;
413
+				if ($hasChangeLog) {
414
+									$newValues = $row;
415
+				}
405 416
 				// ddt table value - format row data and append the uuid
406 417
 				$this->convertFromPHPToDB($classType, $row, $links);
407 418
 				$uuid = (!empty($row['_uuid']) && $this->isUUID($row['_uuid'])) ? $row['_uuid'] : $this->generateUUID();
@@ -411,8 +422,9 @@  discard block
 block discarded – undo
411 422
 				// object table row value
412 423
 				$objectDbRows[] = [$row['_uuid'], $classType, $now, $now];
413 424
 				$objectsLinks[$row['_uuid']] = $links;
414
-				if ($hasChangeLog)
415
-					$this->createChangeLogEntry($class, 'ADD', $uuid, [], $newValues);
425
+				if ($hasChangeLog) {
426
+									$this->createChangeLogEntry($class, 'ADD', $uuid, [], $newValues);
427
+				}
416 428
 			}
417 429
 			neon()->db->createCommand()->batchInsert(DdsObject::tableName(), ['_uuid', '_class_type', '_created', '_updated'], $objectDbRows)->execute();
418 430
 			neon()->db->createCommand()->batchInsert($table, $columns, $rows)->execute();
@@ -446,20 +458,23 @@  discard block
 block discarded – undo
446 458
 	public function editObject($uuid, array $changes, &$changeLogUuid = null)
447 459
 	{
448 460
 		// check there are some changes to make
449
-		if (count($changes) == 0)
450
-			return false;
461
+		if (count($changes) == 0) {
462
+					return false;
463
+		}
451 464
 
452 465
 		// check that the object exists and find its class type
453
-		if (!$this->getObjectFromId($uuid, $object))
454
-			throw new \InvalidArgumentException("Couldn't edit object with id $uuid as not found");
466
+		if (!$this->getObjectFromId($uuid, $object)) {
467
+					throw new \InvalidArgumentException("Couldn't edit object with id $uuid as not found");
468
+		}
455 469
 
456 470
 		// see if we need to store the change log
457 471
 		$class = null;
458 472
 		$this->findClass($object['_class_type'], $class);
459 473
 
460 474
 		$object->_updated = date('Y-m-d H:i:s');
461
-		if (!$object->save())
462
-			return $object->errors;
475
+		if (!$object->save()) {
476
+					return $object->errors;
477
+		}
463 478
 
464 479
 		// now update any member changes
465 480
 		try {
@@ -488,8 +503,9 @@  discard block
 block discarded – undo
488 503
 					}
489 504
 				}
490 505
 			}
491
-			if (count($updates) == 0)
492
-				return false;
506
+			if (count($updates) == 0) {
507
+							return false;
508
+			}
493 509
 
494 510
 			$query = "UPDATE `$table` SET " . implode(', ', $updates) . " WHERE `_uuid`='$uuid' LIMIT 1";
495 511
 			neon()->db->createCommand($query)->bindValues($values)->execute();
@@ -498,8 +514,9 @@  discard block
 block discarded – undo
498 514
 			$this->setMemberLinks($object->_uuid, $links);
499 515
 
500 516
 			// finally note the changes in the change log
501
-			if ($class && $class->hasChangeLog())
502
-				$changeLogUuid = $this->createChangeLogEntry($class, 'EDIT', $uuid, $originalValues, $newValues);
517
+			if ($class && $class->hasChangeLog()) {
518
+							$changeLogUuid = $this->createChangeLogEntry($class, 'EDIT', $uuid, $originalValues, $newValues);
519
+			}
503 520
 		} catch (\yii\db\exception $e) {
504 521
 			$this->clearCaches();
505 522
 			return ['error' => $e->getMessage()];
@@ -521,12 +538,14 @@  discard block
 block discarded – undo
521 538
 	 */
522 539
 	public function editObjects($classType, array $uuids, array $changes)
523 540
 	{
524
-		if (count($uuids) == 0 || count($changes) == 0)
525
-			return false;
541
+		if (count($uuids) == 0 || count($changes) == 0) {
542
+					return false;
543
+		}
526 544
 		try {
527 545
 			$uuids = $this->checkUuidsAgainstClassType($uuids, $classType);
528
-			if (count($uuids) == 0)
529
-				return false;
546
+			if (count($uuids) == 0) {
547
+							return false;
548
+			}
530 549
 			$table = $this->getTableFromClassType($classType);
531 550
 			$memberStorage = $this->getMemberStorage($classType);
532 551
 			if (count($memberStorage) == 0) {
@@ -537,8 +556,9 @@  discard block
 block discarded – undo
537 556
 			$class = null;
538 557
 			$this->findClass($classType, $class);
539 558
 			if ($class && $class->hasChangeLog()) {
540
-				foreach ($uuids as $uuid)
541
-					$beforeValues[$uuid] = array_intersect_key($this->getObject($uuid), $changes);
559
+				foreach ($uuids as $uuid) {
560
+									$beforeValues[$uuid] = array_intersect_key($this->getObject($uuid), $changes);
561
+				}
542 562
 				$newValues = $changes;
543 563
 			}
544 564
 
@@ -560,8 +580,9 @@  discard block
 block discarded – undo
560 580
 					}
561 581
 				}
562 582
 			}
563
-			if (count($updates) == 0)
564
-				return false;
583
+			if (count($updates) == 0) {
584
+							return false;
585
+			}
565 586
 
566 587
 			// sort out the uuid clause for both the update on the table and in the object table
567 588
 			$uuidClause = [];
@@ -589,8 +610,9 @@  discard block
 block discarded – undo
589 610
 
590 611
 			// and save entries into a change log
591 612
 			if ($class && $class->hasChangeLog()) {
592
-				foreach ($beforeValues as $uuid => $before)
593
-					$this->createChangeLogEntry($class, 'EDIT', $uuid, $before, $newValues);
613
+				foreach ($beforeValues as $uuid => $before) {
614
+									$this->createChangeLogEntry($class, 'EDIT', $uuid, $before, $newValues);
615
+				}
594 616
 			}
595 617
 		} catch (\yii\db\exception $e) {
596 618
 			$this->clearCaches();
@@ -610,8 +632,9 @@  discard block
 block discarded – undo
610 632
 		if ($this->getObjectFromId($uuid, $object) && $object->_deleted == 0) {
611 633
 			$object->_deleted = 1;
612 634
 			$object->_updated = date('Y-m-d H:i:s');
613
-			if (!$object->save())
614
-				throw new \RuntimeException("Couldn't delete the object: " . print_r($object->errors, true));
635
+			if (!$object->save()) {
636
+							throw new \RuntimeException("Couldn't delete the object: " . print_r($object->errors, true));
637
+			}
615 638
 			// and update the class object deleted count
616 639
 			$class = null;
617 640
 			$this->findClass($object['_class_type'], $class);
@@ -619,8 +642,9 @@  discard block
 block discarded – undo
619 642
 			$class->save();
620 643
 
621 644
 			// see if we need to store the change log
622
-			if ($class && $class->hasChangeLog())
623
-				$changeLogUuid = $this->createChangeLogEntry($class, 'DELETE', $uuid);
645
+			if ($class && $class->hasChangeLog()) {
646
+							$changeLogUuid = $this->createChangeLogEntry($class, 'DELETE', $uuid);
647
+			}
624 648
 
625 649
 			/** ---- KEEP ME ----
626 650
 			 * don't delete the links so any that haven't been deleted between
@@ -643,8 +667,9 @@  discard block
 block discarded – undo
643 667
 	public function deleteObjects(array $uuids)
644 668
 	{
645 669
 		$objects = $this->getObjectRowsFromIds($uuids);
646
-		if (count($objects) == 0)
647
-			return;
670
+		if (count($objects) == 0) {
671
+					return;
672
+		}
648 673
 
649 674
 		$foundUuids = [];
650 675
 		$foundClasses = [];
@@ -661,8 +686,9 @@  discard block
 block discarded – undo
661 686
 				$deletedUuids[$classType][$obj['_uuid']] = $obj['_uuid'];
662 687
 			}
663 688
 		}
664
-		if (count($foundUuids))
665
-			DdsObject::updateAll(['_deleted' => 1, '_updated' => date('Y-m-d H:i:s')], ['_uuid' => $foundUuids]);
689
+		if (count($foundUuids)) {
690
+					DdsObject::updateAll(['_deleted' => 1, '_updated' => date('Y-m-d H:i:s')], ['_uuid' => $foundUuids]);
691
+		}
666 692
 		foreach ($foundClasses as $type => $count) {
667 693
 			$class = null;
668 694
 			if ($this->findClass($type, $class)) {
@@ -670,8 +696,9 @@  discard block
 block discarded – undo
670 696
 				$class->save();
671 697
 				// TODO 20200107 Make a bulk call for change log entries
672 698
 				if ($class->hasChangeLog()) {
673
-					foreach ($deletedUuids[$class->class_type] as $objUuid)
674
-						$this->createChangeLogEntry($class, 'DELETE', $objUuid);
699
+					foreach ($deletedUuids[$class->class_type] as $objUuid) {
700
+											$this->createChangeLogEntry($class, 'DELETE', $objUuid);
701
+					}
675 702
 				}
676 703
 			}
677 704
 		}
@@ -698,8 +725,9 @@  discard block
 block discarded – undo
698 725
 		if ($this->getObjectFromId($uuid, $object) && $object->_deleted == 1) {
699 726
 			$object->_deleted = 0;
700 727
 			$object->_updated = date('Y-m-d H:i:s');
701
-			if (!$object->save())
702
-				throw new \RuntimeException("Couldn't undelete the object: " . print_r($object->errors, true));
728
+			if (!$object->save()) {
729
+							throw new \RuntimeException("Couldn't undelete the object: " . print_r($object->errors, true));
730
+			}
703 731
 
704 732
 			// and update the class object deleted count
705 733
 			$class = null;
@@ -708,8 +736,9 @@  discard block
 block discarded – undo
708 736
 				$class->save();
709 737
 
710 738
 				// see if we need to store the change log
711
-				if ($class->hasChangeLog())
712
-					$changeLogUuid = $this->createChangeLogEntry($class, 'UNDELETE', $uuid);
739
+				if ($class->hasChangeLog()) {
740
+									$changeLogUuid = $this->createChangeLogEntry($class, 'UNDELETE', $uuid);
741
+				}
713 742
 			}
714 743
 			$this->clearCaches();
715 744
 		}
@@ -724,8 +753,9 @@  discard block
 block discarded – undo
724 753
 		if ($this->getObjectFromId($uuid, $object)) {
725 754
 			$class = null;
726 755
 			$this->findClass($object['_class_type'], $class);
727
-			if ($class && $class->hasChangeLog())
728
-				$originalValues = $this->getObject($uuid);
756
+			if ($class && $class->hasChangeLog()) {
757
+							$originalValues = $this->getObject($uuid);
758
+			}
729 759
 
730 760
 			// delete any object table data
731 761
 			$table = $this->getTableFromClassType($object['_class_type']);
@@ -741,8 +771,9 @@  discard block
 block discarded – undo
741 771
 			// then if ok, decrement the class's object counts
742 772
 			if ($class) {
743 773
 				$class->count_total = max(0, $class->count_total - 1);
744
-				if ($object['_deleted'] == 1)
745
-					$class->count_deleted = max(0, $class->count_deleted - 1);
774
+				if ($object['_deleted'] == 1) {
775
+									$class->count_deleted = max(0, $class->count_deleted - 1);
776
+				}
746 777
 				$class->save();
747 778
 			}
748 779
 
@@ -750,8 +781,9 @@  discard block
 block discarded – undo
750 781
 			DdsLink::deleteAll(['or', ['from_id' => $uuid], ['to_id' => $uuid]]);
751 782
 
752 783
 			// and note this is in the change log
753
-			if ($class && $class->hasChangeLog())
754
-				$changeLogUuid = $this->createChangeLogEntry($class, 'DESTROY', $uuid, $originalValues);
784
+			if ($class && $class->hasChangeLog()) {
785
+							$changeLogUuid = $this->createChangeLogEntry($class, 'DESTROY', $uuid, $originalValues);
786
+			}
755 787
 
756 788
 			$this->clearCaches();
757 789
 		}
@@ -763,16 +795,18 @@  discard block
 block discarded – undo
763 795
 	public function destroyObjects(array $uuids)
764 796
 	{
765 797
 		$objects = $this->getObjectRowsFromIds($uuids);
766
-		if (count($objects) == 0)
767
-			return;
798
+		if (count($objects) == 0) {
799
+					return;
800
+		}
768 801
 
769 802
 		$objectUuids = [];
770 803
 		$objectsDeleted = [];
771 804
 		$classUuids = [];
772 805
 		foreach ($objects as $obj) {
773 806
 			$objectUuids[$obj['_uuid']] = $obj['_uuid'];
774
-			if ($obj['_deleted'] == 1)
775
-				$objectsDeleted[$obj['_class_type']][$obj['_uuid']] = $obj['_uuid'];
807
+			if ($obj['_deleted'] == 1) {
808
+							$objectsDeleted[$obj['_class_type']][$obj['_uuid']] = $obj['_uuid'];
809
+			}
776 810
 			$classUuids[$obj['_class_type']][] = $obj['_uuid'];
777 811
 		}
778 812
 
@@ -799,8 +833,9 @@  discard block
 block discarded – undo
799 833
 			// decrement the class's object counts
800 834
 			if ($class) {
801 835
 				$class->count_total = max(0, $class->count_total - count($uuids));
802
-				if (isset($objectsDeleted[$classType]))
803
-					$class->count_deleted = max(0, $class->count_deleted - count($objectsDeleted[$classType]));
836
+				if (isset($objectsDeleted[$classType])) {
837
+									$class->count_deleted = max(0, $class->count_deleted - count($objectsDeleted[$classType]));
838
+				}
804 839
 				$class->save();
805 840
 			}
806 841
 		}
@@ -852,8 +887,9 @@  discard block
 block discarded – undo
852 887
 	 */
853 888
 	private function getObjectMapManager()
854 889
 	{
855
-		if (!$this->_objectMapManager)
856
-			$this->_objectMapManager = new DdsObjectMapManager;
890
+		if (!$this->_objectMapManager) {
891
+					$this->_objectMapManager = new DdsObjectMapManager;
892
+		}
857 893
 		return $this->_objectMapManager;
858 894
 	}
859 895
 
@@ -868,14 +904,16 @@  discard block
 block discarded – undo
868 904
 		// then see if there are any multilinks to extract
869 905
 		if ($links === null) {
870 906
 			$objectIds = [];
871
-			foreach ($dataSet as $row)
872
-				$objectIds[] = $row['_uuid'];
907
+			foreach ($dataSet as $row) {
908
+							$objectIds[] = $row['_uuid'];
909
+			}
873 910
 			$links = $this->getMembersLinks($objectIds);
874 911
 		}
875 912
 		foreach ($dataSet as &$data) {
876 913
 			// convert full rows to database. Totals are left untouched
877
-			if (isset($data[$classTypeKey]))
878
-				$this->convertFromDBToPHP($data, $links[$data['_uuid']], $classTypeKey);
914
+			if (isset($data[$classTypeKey])) {
915
+							$this->convertFromDBToPHP($data, $links[$data['_uuid']], $classTypeKey);
916
+			}
879 917
 		}
880 918
 	}
881 919
 
@@ -942,8 +980,9 @@  discard block
 block discarded – undo
942 980
 		// a randomly generated resultKey prevents db query chaching.
943 981
 		$resultKey = $resultKey ? $resultKey : $request['requestKey'] . '_' . $counter;
944 982
 		$request['resultKey'] = $resultKey;
945
-		if (!array_key_exists($request['requestKey'], self::$_requestResultsCache))
946
-			$this->convertRequestToSql($request);
983
+		if (!array_key_exists($request['requestKey'], self::$_requestResultsCache)) {
984
+					$this->convertRequestToSql($request);
985
+		}
947 986
 		// store the request
948 987
 		$this->objectRequests[$request['classType']][$resultKey] = $request;
949 988
 		return $resultKey;
@@ -1052,8 +1091,9 @@  discard block
 block discarded – undo
1052 1091
 		$join = ['INNER JOIN dds_object `o` on `t`.`_uuid` = `o`.`_uuid`'];
1053 1092
 		// now see what else needs to be added
1054 1093
 		foreach ($links as $l) {
1055
-			if (in_array($l, $filterKeys))
1056
-				$join[] = "LEFT JOIN dds_link `link_$l` ON (`link_$l`.`from_id`=`o`.`_uuid` AND `link_$l`.`from_member`='$l')";
1094
+			if (in_array($l, $filterKeys)) {
1095
+							$join[] = "LEFT JOIN dds_link `link_$l` ON (`link_$l`.`from_id`=`o`.`_uuid` AND `link_$l`.`from_member`='$l')";
1096
+			}
1057 1097
 		}
1058 1098
 		return implode(' ', $join);
1059 1099
 	}
@@ -1070,11 +1110,13 @@  discard block
 block discarded – undo
1070 1110
 	{
1071 1111
 		$filterKeys = [];
1072 1112
 		$notDeleted = '`o`.`_deleted`=0';
1073
-		if (count($filters) == 0)
1074
-			return $includeDeleted ? '' : "WHERE $notDeleted";
1113
+		if (count($filters) == 0) {
1114
+					return $includeDeleted ? '' : "WHERE $notDeleted";
1115
+		}
1075 1116
 		$this->createFilterClause($filters, $links, $filterKeys);
1076
-		if (!$includeDeleted)
1077
-			return "WHERE $notDeleted AND ($filters[sql])";
1117
+		if (!$includeDeleted) {
1118
+					return "WHERE $notDeleted AND ($filters[sql])";
1119
+		}
1078 1120
 		return "WHERE $filters[sql]";
1079 1121
 	}
1080 1122
 
@@ -1092,8 +1134,9 @@  discard block
 block discarded – undo
1092 1134
 		// filter down until we hit the actual filters
1093 1135
 		if (is_array($filters[0])) {
1094 1136
 			foreach ($filters as $k => &$filter) {
1095
-				if ($k === 'logic')
1096
-					continue;
1137
+				if ($k === 'logic') {
1138
+									continue;
1139
+				}
1097 1140
 				$this->createFilterClause($filter, $links, $filterKeys);
1098 1141
 			}
1099 1142
 
@@ -1105,25 +1148,28 @@  discard block
 block discarded – undo
1105 1148
 				// in which case we combine those with to get the filterSql
1106 1149
 				$filterSql = [];
1107 1150
 				foreach ($filters as $k => &$filter) {
1108
-					if ($k === 'logic')
1109
-						continue;
1151
+					if ($k === 'logic') {
1152
+											continue;
1153
+					}
1110 1154
 					// use the logic keys if any for the items - these can be in position 3
1111 1155
 					// for most operators and position 2 for operators that don't take a key
1112 1156
 					if ($this->operatorTakesObject($filter[1])) {
1113
-						if (isset($filter[3]))
1114
-							$filterSql[$filter[3]] = $filter['itemSql'];
1115
-						else
1116
-							$filterSql[] = $filter['itemSql'];
1157
+						if (isset($filter[3])) {
1158
+													$filterSql[$filter[3]] = $filter['itemSql'];
1159
+						} else {
1160
+													$filterSql[] = $filter['itemSql'];
1161
+						}
1117 1162
 					} else {
1118
-						if (isset($filter[2]))
1119
-							$filterSql[$filter[2]] = $filter['itemSql'];
1120
-						else
1121
-							$filterSql[] = $filter['itemSql'];
1163
+						if (isset($filter[2])) {
1164
+													$filterSql[$filter[2]] = $filter['itemSql'];
1165
+						} else {
1166
+													$filterSql[] = $filter['itemSql'];
1167
+						}
1122 1168
 					}
1123 1169
 				}
1124
-				if (empty($filters['logic']))
1125
-					$filters['filterSql'] = $filters['sql'] = implode(' AND ', $filterSql);
1126
-				else {
1170
+				if (empty($filters['logic'])) {
1171
+									$filters['filterSql'] = $filters['sql'] = implode(' AND ', $filterSql);
1172
+				} else {
1127 1173
 					// make sure we test logic filters in order from longest key to shortest key
1128 1174
 					// otherwise we can end up with subkeys screwing things up
1129 1175
 					$orderedKeys = array_map('strlen', array_keys($filterSql));
@@ -1135,8 +1181,9 @@  discard block
 block discarded – undo
1135 1181
 					// double conversion,
1136 1182
 					$keys = array_keys($filterSql);
1137 1183
 					$keys2hashed = array();
1138
-					foreach ($keys as $k)
1139
-						$keys2hashed[$k] = md5($k);
1184
+					foreach ($keys as $k) {
1185
+											$keys2hashed[$k] = md5($k);
1186
+					}
1140 1187
 					$logicPass1 = str_replace($keys, $keys2hashed, $filters['logic']);
1141 1188
 					$filters['filterSql'] = $filters['sql'] = str_replace($keys2hashed, array_values($filterSql), $logicPass1);
1142 1189
 				}
@@ -1159,9 +1206,9 @@  discard block
 block discarded – undo
1159 1206
 		//
1160 1207
 		$filter = (in_array($filters[0], $links) ? "`link_{$filters[0]}`.`to_id`" : $this->quoteField($filters[0]));
1161 1208
 		$filterKeys[$filters[0]] = $filters[0];
1162
-		if ($this->operatorTakesObject($filters[1]) && isset($filters[2]))
1163
-			$filters['itemSql'] = $filters['sql'] = "$filter " . $this->prepareForPDO($filters[1], $filters[2]);
1164
-		else {
1209
+		if ($this->operatorTakesObject($filters[1]) && isset($filters[2])) {
1210
+					$filters['itemSql'] = $filters['sql'] = "$filter " . $this->prepareForPDO($filters[1], $filters[2]);
1211
+		} else {
1165 1212
 			$filters['itemSql'] = $filters['sql'] = "$filter $filters[1]";
1166 1213
 		}
1167 1214
 	}
@@ -1170,21 +1217,25 @@  discard block
 block discarded – undo
1170 1217
 	{
1171 1218
 		if (is_array($value)) {
1172 1219
 			$pdoValues = [];
1173
-			if (!in_array($operator, ['=', '!=', 'IN', 'NOT IN']))
1174
-				throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of values with an operator of $operator");
1220
+			if (!in_array($operator, ['=', '!=', 'IN', 'NOT IN'])) {
1221
+							throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of values with an operator of $operator");
1222
+			}
1175 1223
 			foreach ($value as $v) {
1176
-				if (is_array($v))
1177
-					throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of *array* of values as filters (silly billy). You passed " . print_r($value, true));
1224
+				if (is_array($v)) {
1225
+									throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of *array* of values as filters (silly billy). You passed " . print_r($value, true));
1226
+				}
1178 1227
 				$count = count($this->boundValues);
1179 1228
 				$variable = ":var{$count}end";
1180 1229
 				$this->boundValues[$variable] = $v;
1181 1230
 				$pdoValues[] = $variable;
1182 1231
 			}
1183 1232
 			// converts equals to ins and outs
1184
-			if ($operator == '=')
1185
-				$operator = 'IN';
1186
-			if ($operator == '!=')
1187
-				$operator = 'NOT IN';
1233
+			if ($operator == '=') {
1234
+							$operator = 'IN';
1235
+			}
1236
+			if ($operator == '!=') {
1237
+							$operator = 'NOT IN';
1238
+			}
1188 1239
 			return "$operator (" . implode(',', $pdoValues) . ')';
1189 1240
 		} else {
1190 1241
 			$count = count($this->boundValues);
@@ -1208,8 +1259,9 @@  discard block
 block discarded – undo
1208 1259
 	 */
1209 1260
 	private function extractOrderClause($order)
1210 1261
 	{
1211
-		if (count($order) == 0)
1212
-			return '';
1262
+		if (count($order) == 0) {
1263
+					return '';
1264
+		}
1213 1265
 		$clause = [];
1214 1266
 		foreach ($order as $o => $d) {
1215 1267
 			// if any of the order clauses are RAND then replace whole clause
@@ -1218,10 +1270,11 @@  discard block
 block discarded – undo
1218 1270
 				break;
1219 1271
 			}
1220 1272
 			// allow negative ordering in mysql for nulls last
1221
-			if (strpos($o, '-') === 0)
1222
-				$clause[] = '-' . substr($o, 1) . " $d";
1223
-			else
1224
-				$clause[] = "$o $d";
1273
+			if (strpos($o, '-') === 0) {
1274
+							$clause[] = '-' . substr($o, 1) . " $d";
1275
+			} else {
1276
+							$clause[] = "$o $d";
1277
+			}
1225 1278
 		}
1226 1279
 		return 'ORDER BY ' . implode(', ', $clause);
1227 1280
 	}
@@ -1233,8 +1286,9 @@  discard block
 block discarded – undo
1233 1286
 	 */
1234 1287
 	private function extractLimitClause($limit)
1235 1288
 	{
1236
-		if (count($limit) == 0)
1237
-			return '';
1289
+		if (count($limit) == 0) {
1290
+					return '';
1291
+		}
1238 1292
 		return "LIMIT $limit[start], $limit[length]";
1239 1293
 	}
1240 1294
 
@@ -1245,8 +1299,9 @@  discard block
 block discarded – undo
1245 1299
 	 */
1246 1300
 	private function setMembersLinks($objectsLinks, $chunkSize)
1247 1301
 	{
1248
-		if (count($objectsLinks) === 0)
1249
-			return 0;
1302
+		if (count($objectsLinks) === 0) {
1303
+					return 0;
1304
+		}
1250 1305
 		$totalCount = 0;
1251 1306
 		$db = neon()->db;
1252 1307
 		$ddsLink = DdsLink::tableName();
@@ -1256,15 +1311,18 @@  discard block
 block discarded – undo
1256 1311
 			$deleteLinkClauses = [];
1257 1312
 			foreach ($chunkData as $fromUuid => $toMemberLinks) {
1258 1313
 				// check you've been supplied with rinky dinky data
1259
-				if (!$this->isUUID($fromUuid))
1260
-					throw new \InvalidArgumentException("The fromUuid should be a UUID64. You passed in $fromUuid");
1314
+				if (!$this->isUUID($fromUuid)) {
1315
+									throw new \InvalidArgumentException("The fromUuid should be a UUID64. You passed in $fromUuid");
1316
+				}
1261 1317
 				foreach ($toMemberLinks as $member => $toLinks) {
1262
-					if (!is_array($toLinks))
1263
-						$toLinks = [$toLinks];
1318
+					if (!is_array($toLinks)) {
1319
+											$toLinks = [$toLinks];
1320
+					}
1264 1321
 					// remove any empty toLinks that might have snuck through
1265 1322
 					$toLinks = array_filter($toLinks);
1266
-					if (!$this->areUUIDs($toLinks))
1267
-						throw new \InvalidArgumentException("The toMemberLinks should be UUID64s. You passed in " . print_r($toLinks, true));
1323
+					if (!$this->areUUIDs($toLinks)) {
1324
+											throw new \InvalidArgumentException("The toMemberLinks should be UUID64s. You passed in " . print_r($toLinks, true));
1325
+					}
1268 1326
 					$toLinks = array_unique($toLinks);
1269 1327
 
1270 1328
 					//
@@ -1279,8 +1337,9 @@  discard block
 block discarded – undo
1279 1337
 
1280 1338
 					// prepare the new links ready for bulk insert
1281 1339
 					$count += count($toLinks);
1282
-					foreach ($toLinks as $toLink)
1283
-						$batchInsert[] = ['from_id' => $fromUuid, 'from_member' => $member, 'to_id' => $toLink];
1340
+					foreach ($toLinks as $toLink) {
1341
+											$batchInsert[] = ['from_id' => $fromUuid, 'from_member' => $member, 'to_id' => $toLink];
1342
+					}
1284 1343
 				}
1285 1344
 			}
1286 1345
 			if (count($deleteLinkClauses)) {
@@ -1289,10 +1348,12 @@  discard block
 block discarded – undo
1289 1348
 			}
1290 1349
 
1291 1350
 			$insertedCount = 0;
1292
-			if (count($batchInsert))
1293
-				$insertedCount = $db->createCommand()->batchInsert($ddsLink, ['from_id', 'from_member', 'to_id'], $batchInsert)->execute();
1294
-			if (YII_DEBUG && $insertedCount !== $count)
1295
-				throw new \Exception("The link insertion failed - $count items should have been inserted vs $insertedCount actual");
1351
+			if (count($batchInsert)) {
1352
+							$insertedCount = $db->createCommand()->batchInsert($ddsLink, ['from_id', 'from_member', 'to_id'], $batchInsert)->execute();
1353
+			}
1354
+			if (YII_DEBUG && $insertedCount !== $count) {
1355
+							throw new \Exception("The link insertion failed - $count items should have been inserted vs $insertedCount actual");
1356
+			}
1296 1357
 			$totalCount += $count;
1297 1358
 		}
1298 1359
 		return $totalCount;
@@ -1333,8 +1394,9 @@  discard block
 block discarded – undo
1333 1394
 	 */
1334 1395
 	protected function getMembersLinks(array $objectIds)
1335 1396
 	{
1336
-		if (empty($objectIds))
1337
-			return [];
1397
+		if (empty($objectIds)) {
1398
+					return [];
1399
+		}
1338 1400
 		$objectIds = array_unique($objectIds);
1339 1401
 		sort($objectIds, SORT_STRING);
1340 1402
 		$cacheKey = md5(serialize($objectIds));
@@ -1346,8 +1408,9 @@  discard block
 block discarded – undo
1346 1408
 				->asArray()
1347 1409
 				->all();
1348 1410
 			$multilinks = array_fill_keys($objectIds, []);
1349
-			foreach ($rows as $row)
1350
-				$multilinks[$row['from_id']][$row['from_member']][] = $row['to_id'];
1411
+			foreach ($rows as $row) {
1412
+							$multilinks[$row['from_id']][$row['from_member']][] = $row['to_id'];
1413
+			}
1351 1414
 			self::$_linkResultsCache[$cacheKey] = $multilinks;
1352 1415
 		}
1353 1416
 		return self::$_linkResultsCache[$cacheKey];
@@ -1364,8 +1427,9 @@  discard block
 block discarded – undo
1364 1427
 	private function createChangeLogEntry($class, $changeKey, $objectUuid, $originalValues = [], $newValues = [])
1365 1428
 	{
1366 1429
 		static $changeLog = null;
1367
-		if (!$changeLog)
1368
-			$changeLog = neon('dds')->IDdsChangeLogManagement;
1430
+		if (!$changeLog) {
1431
+					$changeLog = neon('dds')->IDdsChangeLogManagement;
1432
+		}
1369 1433
 		return $changeLog->addLogEntry($objectUuid, $class->toArray(), $changeKey, $originalValues, $newValues);
1370 1434
 	}
1371 1435
 
Please login to merge, or discard this patch.