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
All of the methods for moving nodes can break the nested set. For instance let's have structure like this:
LFT name RGT
1 root 6
2 section 5
3 subsection 4
If I call method moveAsLastChildOf (section -> subsection) it will break the hierarchy instead of throw an exception. (issued by mlueft). For this problem I have found a simple fix:
public function moveAsLastChildOf(NodeWrapper $node)
{
// Added ancestor check
if($this->isAncestorOf($node) || $this == $node)
{
throw new \InvalidArgumentException('Cannot move node as a child of itself');
}
...
Same for moveAsFirstChildOf().
The siblings methods however are more complicated especially moveAsPrevSiblingOf(subsection->section) which should be possible to do.
Any solutions?
The text was updated successfully, but these errors were encountered:
I just changed the first conditions of the methods to:
public function moveAsPrevSiblingOf(NodeWrapper $node)
{
if($this->isAncestorOf($node) || $this->isRoot() || $node->isRoot() || $node == $this)
{
throw new \InvalidArgumentException('Cannot move node as a sibling of itself');
}
...
All of the methods for moving nodes can break the nested set. For instance let's have structure like this:
LFT name RGT
1 root 6
2 section 5
3 subsection 4
If I call method moveAsLastChildOf (section -> subsection) it will break the hierarchy instead of throw an exception. (issued by mlueft). For this problem I have found a simple fix:
Same for moveAsFirstChildOf().
The siblings methods however are more complicated especially moveAsPrevSiblingOf(subsection->section) which should be possible to do.
Any solutions?
The text was updated successfully, but these errors were encountered: