Doctrine 1
  1. Doctrine 1
  2. DC-890

public function detach break the nested set tree [patch attached]

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Nested Set
    • Labels:
      None
    • Environment:
      not environment dependant

      Description

      If I detach a node from the tree using $node->detach(); it set the left and right value to zero without shifting, creating a possible tree corruption.
      It still work somehow because inserting a new node will shift the value but keep the hole in the tree.

      I've looked to the original commit in Trac (http://trac.doctrine-project.org/changeset/4089) and I don't think the original idea of the commit was to leave a hole.
      I've added 3 lines of code (that I copied from the delete function which works properly), the coresponding patch is joigned to the bug ticket

      1. NestedSet.patch
        0.5 kB
        Alexandre PAIXAO

        Activity

        Hide
        Alexandre PAIXAO added a comment -

        ex:

        root 1 4
        - node A 2 3

        after detach :

        root 1 4
        - node A 0 0

        then a new one :

        root 1 6
        - node B 4 5
        - node A 0 0

        Show
        Alexandre PAIXAO added a comment - ex: root 1 4 - node A 2 3 after detach : root 1 4 - node A 0 0 then a new one : root 1 6 - node B 4 5 - node A 0 0

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Alexandre PAIXAO
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: