コード例 #1
0
ファイル: Product.php プロジェクト: black-lamp/blcms-shop
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getParams()
 {
     return $this->hasMany(Param::className(), ['product_id' => 'id']);
 }
コード例 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getParam()
 {
     return $this->hasOne(Param::className(), ['id' => 'param_id']);
 }
コード例 #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);
 }