/** * @inheritdoc */ public function run() { $class = $this->model; /** @var CommentModel $classModel */ $classModel = CommentModel::findIdentity($class::className()); if ($classModel) { $model = new Comment(['scenario' => 'create']); $model->model_id = $this->model->id; // NewsPost->id, Page->id $model->model_class = $classModel->id; // crc32(NewsPost::class), crc32(Page::class) $models = Comment::getTree($model->model_id, $model->model_class); return $this->render('index', ['models' => $models, 'model' => $model, 'route' => $this->route]); } return ''; }
/** * @param Comment $model Comment * * @return string Comments list */ protected function tree($model) { $models = Comment::getTree($model->model_id, $model->model_class); return $this->renderPartial('@app/modules/comment/widgets/views/_index_item', ['models' => $models]); }