Cannot install creocoder NestedSet Extension

Hi guys,

I already searched for this problem but didn’t find any similar issues, so hopefully someone can help me :)

For a yii2 project I need to use the nested sets extentsion from creocoder (github.com/creocoder/yii2-nested-sets). What I did was to follow his readme and installed the extension with composer. After that I created a database table for test purpose with the relevant fields.

When I call the following two lines of code:


$countries = new Menu(['name' => 'Countries']);

$countries->makeRoot();

I receive an error:

Line 22 is ‘class’ => NestedSetsBehavior::className(),


   public function behaviors() {

        return [

            'tree' => [

                'class' => NestedSetsBehavior::className(),

                // 'treeAttribute' => 'tree',

                // 'leftAttribute' => 'lft',

                // 'rightAttribute' => 'rgt',

                // 'depthAttribute' => 'depth',

            ],

        ];

    }

My namespace in this model is: use creocoder\nestedsets\NestedSetsBehavior;

What could be the problem here?

Finally I solved the problem by loading the classes manually inside the Yii.php with Yii::$classMap

It works now but I still don’t know why I have to load the classes manually :)