You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$this->connection->executeUpdate('DELETE from tree WHERE nested_left = ?',
187
+
[$left]
188
+
);
189
+
190
+
// Move children up a level.
191
+
$this->connection->executeUpdate('UPDATE tree SET nested_right = nested_right - 1, nested_left = nested_left - 1, depth = depth -1 WHERE nested_left BETWEEN ? AND ?',
192
+
[$left, $right]
193
+
);
194
+
195
+
// Move everything back two places.
196
+
$this->connection->executeUpdate('UPDATE tree SET nested_right = nested_right - 2 WHERE nested_right > ?',
197
+
[$right]
198
+
);
199
+
$this->connection->executeUpdate('UPDATE tree SET nested_left = tree.nested_left - 2 WHERE nested_left > ?',
200
+
[$right]
201
+
);
202
+
203
+
$this->connection->commit();
204
+
205
+
}
206
+
catch (Exception$e) {
207
+
$this->connection->rollBack();
208
+
throw$e;
209
+
}
210
+
finally {
211
+
$this->connection->setAutoCommit(TRUE);
212
+
}
213
+
214
+
}
215
+
164
216
/**
165
217
* {@inheritdoc}
166
218
*/
@@ -172,6 +224,7 @@ public function deleteLeafAndDescendants(Leaf $leaf) {
172
224
try {
173
225
$this->connection->beginTransaction();
174
226
227
+
// Delete the leaf.
175
228
$this->connection->executeUpdate('DELETE from tree WHERE nested_left BETWEEN ? AND ?',
0 commit comments