public function save() { //create Match $match = new ExtCorrelation(); $match->account_id = $this->account_id; $match->owner = Yii::app()->user->id; $match->save(); //bankbooks //print_r($this->Bankbooks); //print_r($this->Transactions); foreach ($this->Bankbooks['match'] as $bankbook => $true) { Yii::log("bank:" . $bankbook, 'info', 'app'); $bankbook = Bankbook::model()->findByPk($bankbook); if ($bankbook !== null) { $bankbook->extCorrelation = $match->id; $bankbook->save(); } } //transaction foreach ($this->Transactions['match'] as $transaction => $true) { Yii::log("trans:" . $transaction, 'info', 'app'); $transaction = Transactions::model()->findByPk($transaction); if ($transaction !== null) { $transaction->extCorrelation = $match->id; $transaction->save(); } } return $match->id; }
public function loadModel($id) { $model = Bankbook::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }