/** * Deletes an existing Transfer model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $model = $this->findModel($id); try { $transaction = Yii::$app->db->beginTransaction(); $api = new ApiTransfer(['modelClass' => Transfer::className()]); if ($api->delete($id, $model)) { $transaction->commit(); return $this->redirect(['index']); } else { $transaction->rollBack(); } } catch (\Exception $exc) { $transaction->rollBack(); throw $exc; } }