/** * @param $financeId FinanceRecord::$ID * @return mixed */ public function actionPrint($financeId) { /** @var FinanceRecord $finance */ if (($finance = FinanceRecord::findOne($financeId)) === null) { throw new NotFoundHttpException('The requested page does not exist.'); } $model = new FinanceCheckRecord(); $model->ContractorID = $finance->contractor->ID; $model->FinanceID = $finance->ID; $model->push($finance); $model->save(); return $this->render('print', ['model' => $model]); }
/** * Finds the FinanceRecord model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return FinanceRecord the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = FinanceRecord::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }