Closed gb5256 closed 9 years ago
So you should create a class like this https://github.com/Mihai-P/yii2-core/blob/master/components/NestedQuery.php
And in the actual model you should declare something like this https://github.com/Mihai-P/yii2-core/blob/master/models/Menu.php see the behaviors, transactions and find functions.
The NestedQuery allows you operations like
$leaves = Menu::find()->leaves()->all();
$children = $countries->children()->all();
Thanks for this. The missing point was where to put it and to use use core\components\NestedQuery; inside the model.
PS: I am a very happy user of your yii1 nested set (and now also of this one as it seems...) Thanks again, gb5256
Hello, I am just switching to yii2 from yii1, so it might be that I have a general problem of understanding. You write "Configure query class as follows". But I do not have a query class. I am using the advanced yii2 template. Can you give me a hint where that has to be put? Thanks, gb5256