Open yougeen opened 8 years ago
look if you set class in namespace section
In which file do I need to set this? I used the snippets from the readme and created a Menu and MenuQuery Class and in both files I use creocoder\nestedsets\NestedSetsBehavior;
Where do you receive this error? What is shown in log?
I created a sample Controller and call the model from this one.
The Log shows:
[error][yii\base\ErrorException:1] exception 'yii\base\ErrorException' with message 'Class 'creocoder\nestedsets\NestedSetsBehavior' not found' in /var/www/html/Yii2Dev/basic/models/Menu.php:22
Line 22 is 'class' => NestedSetsBehavior::className(),
public function behaviors() {
return [
'tree' => [
'class' => NestedSetsBehavior::className(),
// 'treeAttribute' => 'tree',
// 'leftAttribute' => 'lft',
// 'rightAttribute' => 'rgt',
// 'depthAttribute' => 'depth',
],
];
}
the namespace I use in this model is:
namespace app\models; use Yii; use creocoder\nestedsets\NestedSetsBehavior;
And in my Controller likes like this:
namespace app\controllers;
use app\models\Menu;
use creocoder\nestedsets\NestedSetsQueryBehavior;
class MenuController extends \yii\web\Controller
{
public function actionIndex()
{
$countries = new Menu(['name' => 'Countries']);
$countries->makeRoot();
return $this->render('index');
}
}
Hope this helps you
Check the vendor folder for extension files, maybe this extension was installed incorrectly.
Hi,
I followed the read me and used composer for the installation and I cannot install this extension properly.
When I call
I receive Class 'creocoder\nestedsets\NestedSetsBehavior' not found
Can someone help me please? Thanks!