コード例 #1
0
 /**
  * Copy record
  * If copy is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be copy
  */
 public function actionCopy($id)
 {
     $data = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['ServicesModel'])) {
         $model = new ServicesModel();
         $model->attributes = $_POST['ServicesModel'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('copy', array('model' => $data));
 }