Пример #1
0
 public function actionCreate($id)
 {
     // $id = categoryId
     $model = new Option();
     $model->setScenario("create");
     if ($model->load(Yii::$app->request->post(), "Option") && $model->validate()) {
         if (OptionService::create($model)) {
             $this->redirect(Url::previous('options'));
         }
     }
     return $this->render('@cmsgears/module-core/admin/views/category/option/create', ['model' => $model, 'id' => $id, 'returnUrl' => Url::previous("options")]);
 }
Пример #2
0
 /**
  * @return Option - from Category 'gender' assigned to user.
  */
 public function getGender()
 {
     return $this->hasOne(Option::className(), ['id' => 'genderId']);
 }
Пример #3
0
 /**
  * @param string $value - option value
  * @param integer $categoryName - category name
  * @return Option
  */
 public static function findByValueCategoryName($value, $categoryName)
 {
     return Option::findByValueCategoryName($value, $categoryName);
 }
Пример #4
0
 /**
  * @return array - list of Option having all the options belonging to this category
  */
 public function getOptions()
 {
     return $this->hasMany(Option::className(), ['categoryId' => 'id']);
 }