Open echo511 opened 13 years ago
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');
}
...
So far it seems to be working.
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?