コード例 #1
0
 /**
  * Creates a new CsObjectPropertyValues model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new CsObjectPropertyValues();
     if ($objectPropertyValues = Yii::$app->request->get('CsObjectPropertyValues')) {
         $model->object_id = !empty($objectPropertyValues['object_id']) ? $objectPropertyValues['object_id'] : null;
         $model->object_property_id = !empty($objectPropertyValues['object_property_id']) ? $objectPropertyValues['object_property_id'] : null;
         $model->property_value_id = !empty($objectPropertyValues['property_value_id']) ? $objectPropertyValues['property_value_id'] : null;
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }