php - Nested sets for Yii2 Invalid argument supplied for foreach() -
i using https://github.com/creocoder/yii2-nested-sets extension yii2!
so, first version yii1 in version have problem.
all done strictly according manual!
when created models earn error:
this error appear @ query category table. if delete behavior entire work ;(
categories model:
<?php namespace backend\models; use creocoder\nestedsets\nestedsetsbehavior; use yii\db\activerecord; class categories extends activerecord { public function behaviors() { return [ 'tree' => [ 'class' => nestedsetsbehavior::classname(), 'treeattribute' => 'tree', ], ]; } public function transactions() { return [ self::scenario_default => self::op_all, ]; } public static function find() { return new categoryquery(get_called_class()); } }
categoryquery model:
<?php namespace backend\models; use creocoder\nestedsets\nestedsetsquerybehavior; use yii\db\activerecord; class categoryquery extends activerecord { public function behaviors() { return [ nestedsetsquerybehavior::classname(), ]; } }
activequery instead activerecord in class categoryquery need
Comments
Post a Comment