public function actionManage($menu_id) { $menu = Menu::model()->findByPk($menu_id); if (!$menu) { $this->pageNotFound(); } $root = MenuSection::model()->roots()->find('menu_id = ' . $menu_id); if (!$root) { $root = new MenuSection(); $root->menu_id = $menu->id; $root->title = $menu->name . '::корень'; $root->saveNode(); } $model = new MenuSection('search'); $model->unsetAttributes(); if (isset($_GET['MenuSection'])) { $model->attributes = $_GET['MenuSection']; } $this->render('manage', ['menu' => $menu, 'model' => $model, 'root' => $root]); }