Exemplo n.º 1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getParams()
 {
     return $this->hasMany(Param::className(), ['product_id' => 'id']);
 }
Exemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getParam()
 {
     return $this->hasOne(Param::className(), ['id' => 'param_id']);
 }
Exemplo n.º 3
0
 /**
  * Deletes param from product model.
  *
  * Users which have 'updateOwnProduct' permission can delete params only for Product models that have been created by their.
  * Users which have 'updateProduct' permission can delete params for all Product models.
  *
  * @param integer $id
  * @return mixed
  * @throws ForbiddenHttpException
  */
 public function actionDeleteParam($id)
 {
     $param = Param::findOne($id);
     $param->delete();
     return $this->redirect(Yii::$app->request->referrer);
 }