Which extension is it?
ENestedSetBehavior
What steps will reproduce the problem? 1. create root
$cars=new Category; $cars->title='Cars'; $cars->saveNode();
DB status (OK):
+-------------+---------+-------+-----+-----+-------+ | category_id | root_id | title | lft | rgt | level | +-------------+---------+-------+-----+-----+-------+ | 1 | 1 | Cars | 1 | 2 | 1 | +-------------+---------+-------+-----+-----+-------+ 1 row in set (0.00 sec)
- Insert a child
$ford=new Category; $ford->title='Ford'; $ford->appendTo($cars);
Db Status (OK):
+-------------+---------+-------+-----+-----+-------+ | category_id | root_id | title | lft | rgt | level | +-------------+---------+-------+-----+-----+-------+ | 1 | 1 | Cars | 1 | 4 | 1 | | 2 | 1 | Ford | 2 | 3 | 2 | +-------------+---------+-------+-----+-----+-------+ 2 rows in set (0.00 sec)
- add child using insertAfter:
$mercedes=new Category; $mercedes->title='Mercedes'; $mercedes->insertAfter($ford);
DB status (wrong):
+-------------+---------+----------+-----+-----+-------+ | category_id | root_id | title | lft | rgt | level | +-------------+---------+----------+-----+-----+-------+ | 1 | 1 | Cars | 1 | 4 | 1 | | 2 | 1 | Ford | 2 | 3 | 2 | | 3 | 1 | Mercedes | 6 | 7 | 2 | +-------------+---------+----------+-----+-----+-------+ 3 rows in set (0.00 sec)
What is the expected output? What do you see instead?
DB status should be:
+-------------+---------+----------+-----+-----+-------+ | category_id | root_id | title | lft | rgt | level | +-------------+---------+----------+-----+-----+-------+ | 1 | 1 | Cars | 1 | 6 | 1 | | 2 | 1 | Ford | 2 | 3 | 2 | | 3 | 1 | Mercedes | 4 | 5 | 2 | +-------------+---------+----------+-----+-----+-------+
What version of the product are you using? On what operating system?
- @version 1.02
- @package yiiext.behaviors.model.trees
Comment #1
Posted on Jul 11, 2011 by Massive Cat(No comment was entered for this change.)
Comment #2
Posted on Jul 11, 2011 by Quick DogComment deleted
Comment #3
Posted on Jul 11, 2011 by Quick DogFixed by 1.03 one week ago, but thanks.
Comment #4
Posted on Jul 12, 2011 by Happy RhinoThanks creocoder, please update the downloads section, and the downloadable file in the Yii extensions site (http://www.yiiframework.com/extension/nestedsetbehavior) so that other get the fixed file, thanks.
Status: Fixed
Labels:
Type-Defect
Priority-Medium