public function actionIndex() { $current_category_type_id = 1; $current_mode = 1; if (Yii::$app->request->get('category_type_id')) { $current_category_type_id = Yii::$app->request->get('category_type_id'); } if (Yii::$app->request->get('mode')) { $current_mode = Yii::$app->request->get('mode'); } $root_category_model = new RootCategory(); $root_category_model->category_type_id = $current_category_type_id; if ($root_category_model->load(Yii::$app->request->post())) { $root_category_model->createRootCategory(); } return $this->render('index', ['current_category_type_id' => $current_category_type_id, 'current_mode' => $current_mode, 'category_types' => CategoryTypes::find()->asArray()->all(), 'unsorted_synonims' => CategoriesSynonims::getUnsorted(), 'root_category_model' => $root_category_model]); }
/** * @return \yii\db\ActiveQuery */ public function getCategoryType() { return $this->hasOne(CategoryTypes::className(), ['id' => 'category_type_id']); }