Example #1
0
 /**
  * Deletes an existing product model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $model = FundProductThirdproduct::find()->where(['product_id' => $id])->all();
     foreach ($model as $V) {
         $thirdproduct_id = $V->thirdproduct_id;
         $thirdModel = Thirdproduct::find()->where(['id' => $thirdproduct_id])->one();
         $thirdModel->process_status = 0;
         $thirdModel->save(false);
     }
     Product::updateAll(['status' => Product::STATUS_DELETE], ['id' => $id]);
     // $this->findModel($id)->delete();
     return $this->redirect(['index']);
 }