ENestedSetBehavior insertBefore() not working as expected

Extension: ENestedSetBehavior (trees_1.2)

The insertBefore() function does not work as expected

Steps executed in a Category controller action method

$root=new Category;

$root->title=‘Mobile Phones’;

$root->saveNode();

$category1=new Category;

$category1->title=‘Samsung’;

$category2=new Category;

$category2->title=‘Motorola’;

$category3=new Category;

$category3->title=‘iPhone’;

$root=Category::model()->find(‘title=“Mobile Phones”’);

$category1->appendTo($root);

$category2->appendTo($root);

$category3->insertBefore($category2);

Expected Output:

Mobile Phones

-Samsung

-iPhone

-Motorola

Achieved Output:

Mobile Phones

-Samsung

-Motorola

-iPhone

‘iPhone’ is not being placed before ‘Motorola’

My system config: Yii 1.1.8, WAMP

Thank you for your observation. Fixed by NestedSetBehavior 1.03. Please update extension from SVN.

Thanks for quick update! I began using the updated version just from yesterday.

Is there a pre-built function/method in which a node can be added to its parent in such a way that all the children are in a fixed order (like ascending order by category name).

For example, there is parent node ‘Mobile’ with three children already in ascending order:

-Apple

-Motorola

-Samsung

If we add a child ‘HTC’ to Mobile, the result would be

-Apple

-HTC

-Motorola

-Samsung

i.e., the child node would be added in the current position by ascending order.

I can write a function to do this, but just wanted to know if this kind of feature is already present in the behavior or another extension.