public function save() { //create Match $match = new IntCorrelation(); $match->account_id = $this->account_id; $match->owner = Yii::$app->user->id; $match->save(); //bankbooks foreach ($this->in as $transaction => $true) { $transaction = Transactions::findOne($transaction); if ($transaction !== null) { $transaction->intCorrelation = $match->id; $transaction->intType = true; $transaction->save(); } } //transaction foreach ($this->out as $transaction => $true) { $transaction = Transactions::findOne($transaction); if ($transaction !== null) { $transaction->intCorrelation = $match->id; $transaction->intType = false; $transaction->save(); } } return $match->id; }
public function actionMatchdelete($id) { $model = IntCorrelation::findOne($id); if ($model === null) { throw new \yii\web\HttpException(404, 'The requested page does not exist.'); } $model->delete(); $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('dispmatch')); }