Development

#2853 (Extrange bug: children is not descendant)

You must first sign up to be able to contribute.

Ticket #2853 (new defect)

Opened 9 months ago

Extrange bug: children is not descendant

Reported by: Carlos.Escribano Assigned to: trivoallan
Priority: minor Milestone:
Component: sfPropelActAsNestedSetBehaviorPlugin Version:
Keywords: Cc:
Qualification: Unreviewed

Description

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.

Attachments

TableFor2853.png (50.6 kB) - added by Carlos.Escribano on 01/28/08 10:23:10.
Data sample

Change History

01/28/08 10:23:10 changed by Carlos.Escribano

  • attachment TableFor2853.png added.

Data sample