creocoder / yii2-nested-sets

The nested sets behavior for the Yii framework.
Other
446 stars 129 forks source link

Can not create a node when the target node is root. #73

Closed bayusuwarninghadi closed 9 years ago

bayusuwarninghadi commented 9 years ago

How to make sibling between a root models?

$model = new Category();
$model->name = 'new category';
$after = $this->findModel(1);
$model->insertAfter($after);

it will throw

throw new Exception('Can not create a node when the target node is root.');
creocoder commented 9 years ago

Multiple roots are independent due to nested sets nature. Use single root mode if you need siblings for nodes, etc.