-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Descendents at depth. #24
Conversation
src/NestedSetInterface.php
Outdated
*/ | ||
public function findDescendants(NodeKey $nodeKey, $depth = 0); | ||
public function findDescendants(NodeKey $nodeKey, $depth = 0, $start = 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but this defaults to 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh it should be 1. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed the fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
@@ -616,6 +662,23 @@ public function testGetTree() { | |||
|
|||
/** | |||
* Loads the test data. | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Without disturbing the existing $depth parameter, this provides an additional $start parameter. This is useful for those wanting to process a tree in layers (say building a visual representation), or if there is meaning to a specific layer, without doing a lot of php processing of the result set.
With the tree used in the tests, you can for example take 1 depth starting at depth 2.
Closes #23