Skip to content

ошибка Model not found. при сохранении ноды #4

@martrix78

Description

@martrix78

В общем ничего не работает кроме переименования корневого элемента :(
при добавлении ноды
/tree/append-to
получаю ответ {"pk":null} и ошибку в консоли TypeError: c is null jstree.min.js (строка 3, столбец 16847)
при изменении названия новой ноды вижу запрос
*modelClass app\models\ApartmentTypes
modelPk j1_2
name test
*

И в ответ приходит 404 ошибка {"name":"Not Found","message":"Model not found.","code":0,"status":404,"type":"yii\web\NotFoundHttpException"
}

кусок модели:

class ApartmentTypes extends \yii\db\ActiveRecord {

    public function behaviors(){
      return [
            'tree' => [
                'class' => NestedSetsBehavior::className(),
                 'treeAttribute' => 'tree',
                 'leftAttribute' => 'lft',
                 'rightAttribute' => 'rgt',
                 'depthAttribute' => 'depth',
            ],
        NestedSetsManagementBehavior::className(),
        [
              'class'              => TimestampBehavior::className(),
              'createdAtAttribute' => 'created',
              'updatedAtAttribute' => 'modified',
        ],
      ];
  }

представление:

<?php
use arogachev\tree\widgets\NestedSets;
use app\models\ApartmentTypes;
?>
<?= NestedSets::widget(['modelClass' => ApartmentTypes::className()]) ?>

Что я делаю не так? :(

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions