| 359 | | |
| 360 | | $this->record['level'] = $dest['level'] - 1; |
| 361 | | $this->insertNode($newLeft, $newRight, $newRoot); |
| | 356 | $newRoot = $dest->getNode()->getRootValue(); |
| | 357 | $newLevel = $dest->getNode()->getLevel(); |
| | 358 | |
| | 359 | // Make space for new node |
| | 360 | $this->shiftRLValues($dest->getNode()->getRightValue() + 1, 2, $newRoot); |
| | 361 | |
| | 362 | // Slide child nodes over one and down one to allow new parent to wrap them |
| | 363 | $componentName = $this->_tree->getBaseComponent(); |
| | 364 | $q = new Doctrine_Query(); |
| | 365 | $q->update($componentName); |
| | 366 | $q->set("$componentName.lft", "$componentName.lft + 1"); |
| | 367 | $q->set("$componentName.rgt", "$componentName.rgt + 1"); |
| | 368 | $q->set("$componentName.level", "$componentName.level + 1"); |
| | 369 | $q->where("$componentName.lft >= ? AND $componentName.rgt <= ?", array($newLeft, $newRight)); |
| | 370 | $q = $this->_tree->returnQueryWithRootId($q, $newRoot); |
| | 371 | $q->execute(); |
| | 372 | |
| | 373 | $this->record['level'] = $newLevel; |
| | 374 | $this->insertNode($newLeft, $newRight, $newRoot); |