Code Duplication    Length = 22-22 lines in 2 locations

www/engine/System/Classes/Modules/Entitizer/Utils/Entity/Modify.php 2 locations

@@ 26-47 (lines=22) @@
23
24
		# Disconnect subtree from current position
25
26
		private function disconnectSubtree() {
27
28
			$query = ("DELETE rla FROM " . static::$table_relations . " rla ") .
29
30
			         ("JOIN "  . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") .
31
32
					 ("LEFT JOIN " . static::$table_relations . " rlx ") .
33
34
					 ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") .
35
36
					 ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL");
37
38
			if (!(DB::send($query) && DB::last()->status)) return false;
39
40
			# Set path
41
42
			$this->data['parent_id'] = 0;
43
44
			# ------------------------
45
46
			return true;
47
		}
48
49
		# Connect subtree under new position
50
@@ 51-72 (lines=22) @@
48
49
		# Connect subtree under new position
50
51
		private function connectSubtree(int $parent_id) {
52
53
			$query = ("INSERT INTO " . static::$table_relations . " (ancestor, descendant, depth) ") .
54
55
			         ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") .
56
57
					 ("FROM " . static::$table_relations . " sup ") .
58
59
					 ("JOIN " . static::$table_relations . " sub ") .
60
61
					 ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id);
62
63
			if (!(DB::send($query) && DB::last()->status)) return false;
64
65
			# Set path
66
67
			$this->data['parent_id'] = $parent_id;
68
69
			# ------------------------
70
71
			return true;
72
		}
73
74
		# Create entity entry in DB
75