public function actionCopy() { $model = new FinvInvoice(); $model->scenario = $this->scenario; if (isset($_GET['finv_id'])) { try { if ($model->duplicate($_GET['finv_id'])) { if (isset($_GET['returnUrl'])) { $this->redirect($_GET['returnUrl']); } else { $this->redirect(array('view', 'finv_id' => $model->finv_id)); } } } catch (Exception $e) { $model->addError('finv_id', $e->getMessage()); } } $this->render('copy', array('model' => $model)); }