I've experimented an extrange bug. I am developing a task system with time tracking, and tasks have sub-tasks. In this system you can delete tasks and add other ones before, after or as a child of another. I do it with this plugin built-in methods:
// Model:
...
$columns_map = array('left' => TareaPeer::TREE_LEFT,
'right' => TareaPeer::TREE_RIGHT,
'parent' => TareaPeer::TREE_PARENT,
'scope' => TareaPeer::PROYECTO_ID);
// Action: add
$task = TareaPeer::retrieveByPK($this->getRequestParameter('id'))
$newTask = new Tarea();
$newTask->setProyectoId($task->getProyectoId()); // Scope
$newTask->setTitulo('Tarea sin tÃtulo');
switch($this->getRequestParameter('posicion', Tarea::BOTTOM))
{
case Tarea::TOP:
case Tarea::BOTTOM:
$newTask->insertAsFirstChildOf($task);
break;
case Tarea::AFTER:
$newTask->insertAsNextSiblingOf($task);
break;
case Tarea::BEFORE:
$newTask->insertAsPrevSiblingOf($task);
break;
}
$newTask->save();
...
// Action: delete
...
$tarea = TareaPeer::retrieveByPK($this->getRequestParameter('id'))
...
$tarea->deleteDescendants();
$tarea->delete();
...
The problem I encountered is that one direct child is not recognized by the getDescendants() method because its tree_right is EQUAL than root's tree_right value and not LESS_THAN.
Excuse me if my english is not very well.