Method |
Description |
|
__construct ( Container $container = null, array $config = [] ) |
Public constructor. Overrides the parent constructor, making sure there are lft/rgt columns which make it
compatible with nested sets. |
|
buildQuery ( boolean $overrideLimits = false ) : JDatabaseQuery |
Overrides the DataModel's buildQuery to allow nested set searches using the provided scopes |
|
check ( ) |
Overrides the automated table checks to handle the 'hash' column for faster searching |
|
copy ( $data = null ) : static |
Makes a copy of the record, inserting it as the last child of the current node's parent. |
|
create ( array $data ) : static |
Create a new record with the provided data. It is inserted as the last child of the current node's parent |
|
equals ( TreeModel &$node ) : boolean |
Is $node this very node? |
|
findByPath ( string $path ) : TreeModel | null |
Locate a node from a given path, e.g. "/some/other/leaf" |
|
forceDelete ( mixed $id = null ) |
Delete a node, either the currently loaded one or the one specified in $id. If an $id is specified that node
is loaded before trying to delete it. In the end the data model is reset. If the node has any children nodes
they will be removed before the node itself is deleted. |
|
getAncestors ( ) : Collection |
Get all ancestors to this node but not the node itself. In other words it gets the path to the node, without the
node itself. |
|
getAncestorsAndSelf ( ) : Collection |
Get all ancestors to this node and the node itself. In other words it gets the full path to the node and the node
itself. |
|
getAncestorsAndSelfWithoutRoot ( ) : Collection |
Get all ancestors to this node and the node itself, but not the root node. If you want to |
|
getAncestorsWithoutRoot ( ) : Collection |
Get all ancestors to this node but not the node itself and its root. |
|
getDescendants ( ) : Collection |
Get only our descendant (children) nodes, not ourselves. |
|
getDescendantsAndSelf ( ) : Collection |
Get all descendant (children) nodes and ourselves. |
|
getImmediateDescendants ( ) : Collection |
Get the immediate descendants (children). Unlike getDescendants it only goes one level deep into the tree
structure. Descendants of descendant nodes will not be returned. |
|
getLeaves ( ) : Collection |
Get all leaf nodes in the tree. You may want to use the scopes to narrow down the search in a specific subtree or
path. |
|
getLevel ( ) : integer | mixed |
Gets the level (depth) of this node in the tree. The result is cached in $this->treeDepth for faster retrieval. |
|
getNestedList ( string $column = 'title', null $key = null, string $seperator = ' ' ) : array |
Returns a hashed array where each element's key is the value of the $key column (default: the ID column of the
table) and its value is the value of the $column column (default: title). Each nesting level will have the value
of the $column column prefixed by a number of $separator strings, as many as its nesting level (depth). |
|
getParent ( ) : static |
Returns the immediate parent of the current node |
|
getRoot ( ) : static |
Returns the root node of the tree this node belongs to |
|
getSiblings ( ) : Collection |
Get all sibling nodes, except ourselves |
|
getSiblingsAndSelf ( ) : Collection |
Get all sibling nodes, including ourselves |
|
inSameScope ( TreeModel $otherNode ) : boolean |
Returns true if both this node and $otherNode are root, leaf or child (same tree scope) |
|
insertAsChildOf ( TreeModel &$parentNode ) |
Alias for insertAsLastchildOf |
|
insertAsFirstChildOf ( TreeModel &$parentNode ) |
Insert the current node as the first (leftmost) child of a parent node. |
|
insertAsLastChildOf ( TreeModel &$parentNode ) |
Insert the current node as the last (rightmost) child of a parent node. |
|
insertAsRoot ( ) : static |
Insert the current node as a tree root. It is a good idea to never use this method, instead providing a root node
in your schema installation and then sticking to only one root. |
|
insertAsSiblingOf ( TreeModel &$siblingNode ) |
Alias for insertRightOf |
|
insertLeftOf ( TreeModel &$siblingNode ) |
Insert the current node to the left of (before) a sibling node |
|
insertRightOf ( TreeModel &$siblingNode ) |
Insert the current node to the right of (after) a sibling node |
|
insideSubtree ( TreeModel $otherNode ) : boolean |
Checks if our node is inside the subtree of $otherNode. This is a fast check as only lft and rgt values have to
be compared. |
|
isAncestorOf ( TreeModel $otherNode ) : boolean |
Returns true if we are an ancestor of $otherNode |
|
isChild ( ) : boolean |
Is this a child node (not root)? |
|
isDescendantOf ( TreeModel $otherNode ) : boolean |
Returns true if we are a descendant of $otherNode |
|
isLeaf ( ) : boolean |
Is this a leaf node (a node without children)? |
|
isRoot ( ) : boolean |
Is this a top-level root node? |
|
isSelfOrAncestorOf ( TreeModel $otherNode ) : boolean |
Returns true if $otherNode is ourselves or we are an ancestor of $otherNode |
|
isSelfOrDescendantOf ( TreeModel $otherNode ) : boolean |
Returns true if $otherNode is ourselves or if we are a descendant of $otherNode |
|
makeChildOf ( TreeModel $parentNode ) |
Alias for makeLastChildOf |
|
makeFirstChildOf ( TreeModel $parentNode ) |
Moves a node and its subtree as a the first (leftmost) child of $parentNode |
|
makeLastChildOf ( TreeModel $parentNode ) |
Moves a node and its subtree as a the last (rightmost) child of $parentNode |
|
makeNextSiblingOf ( TreeModel $siblingNode ) |
Alias for moveToRightOf |
|
makePreviousSiblingOf ( TreeModel $siblingNode ) |
Alias for moveToLeftOf |
|
makeRoot ( ) |
Makes the current node a root (and moving its entire subtree along the way). This is achieved by moving the node
to the right of its root node |
|
makeSiblingOf ( TreeModel $siblingNode ) |
Alias for makeNextSiblingOf |
|
move ( integer $delta, string $where = '' ) : static |
Not supported in nested sets |
|
moveLeft ( ) |
Move the current node (and its subtree) one position to the left in the tree, i.e. before its left-hand sibling |
|
moveRight ( ) |
Move the current node (and its subtree) one position to the right in the tree, i.e. after its right-hand sibling |
|
moveToLeftOf ( TreeModel $siblingNode ) |
Moves the current node (and its subtree) to the left of another node. The other node can be in a different
position in the tree or even under a different root. |
|
moveToRightOf ( TreeModel $siblingNode ) |
Moves the current node (and its subtree) to the right of another node. The other node can be in a different
position in the tree or even under a different root. |
|
reorder ( string $where = '' ) : static |
Not supported in nested sets |
|
reset ( boolean $useDefaults = true, boolean $resetRelations = false ) : static |
Reset the record data and the tree cache |
|
withoutNode ( TreeModel $node ) : void |
get() will not return the selected node if it's part of the query results |
|