creocoder / yii2-nested-sets

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

Calling unknown method: Category::roots() #30

Closed wojciech-klonowski closed 9 years ago

wojciech-klonowski commented 10 years ago

When trying to get all roots by $roots = Category::find()->roots()->all(); I get this exception. How to fix it or get all roots in any other way.

wojciech-klonowski commented 10 years ago

I get solution of this by other way $roots = Category::::findAll(['lft' => '1']); It work good for get roots for me.

CostaRico commented 10 years ago

In my model

/* public static function createQuery() { return new CategoryQuery(['modelClass' => get_called_class()]); }*/

public static function find()
{
    return Yii::createObject(CategoryQuery::className(), [get_called_class()]);
}
creocoder commented 9 years ago

New version of behavior is coming, documentation already fixed.