Skip to content

Commit 38d630c

Browse files
committed
Rename to deleteSubTree and add stubs
1 parent 8bd7d6c commit 38d630c

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/NestedSetInterface.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function deleteLeaf(Leaf $leaf);
3434
* @param \PNX\Tree\Leaf $leaf
3535
* The leaf to delete.
3636
*/
37-
public function deleteLeafAndDescendants(Leaf $leaf);
37+
public function deleteSubTree(Leaf $leaf);
3838

3939
/**
4040
* Finds all descendants of a leaf.
@@ -73,4 +73,14 @@ public function findAncestors(Leaf $leaf);
7373
*/
7474
public function getLeaf($id, $revision_id);
7575

76+
/**
77+
* Moves a Leaf and its sub-tree under a new parent leaf.
78+
*
79+
* @param \PNX\Tree\Leaf $parent
80+
* The parent leaf to move under.
81+
* @param \PNX\Tree\Leaf $leaf
82+
* The leaf to move.
83+
*/
84+
public function moveSubTree(Leaf $parent, Leaf $leaf);
85+
7686
}

src/Storage/DbalNestedSet.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public function deleteLeaf(Leaf $leaf) {
216216
/**
217217
* {@inheritdoc}
218218
*/
219-
public function deleteLeafAndDescendants(Leaf $leaf) {
219+
public function deleteSubTree(Leaf $leaf) {
220220
$left = $leaf->getLeft();
221221
$right = $leaf->getRight();
222222
$width = $right - $left + 1;
@@ -246,4 +246,11 @@ public function deleteLeafAndDescendants(Leaf $leaf) {
246246

247247
}
248248

249+
/**
250+
* {@inheritdoc}
251+
*/
252+
public function moveSubTree(Leaf $parent, Leaf $leaf) {
253+
// TODO: Implement moveSubTree() method.
254+
}
255+
249256
}

tests/Functional/DbalNestedSetTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public function testDeleteLeafAndDescendants() {
220220

221221
$leaf = $this->nestedSet->getLeaf(4, 1);
222222

223-
$this->nestedSet->deleteLeafAndDescendants($leaf);
223+
$this->nestedSet->deleteSubTree($leaf);
224224

225225
// Leaf should be deleted.
226226
$leaf = $this->nestedSet->getLeaf(4, 1);

0 commit comments

Comments
 (0)