controllers/ProgramasController.php
/**
    * Creates a new Programas model by another data,
    * so user don't need to input all field from scratch.
    * If creation is successful, the browser will be redirected to the 'view' page.
    *
    * @param mixed $id
    * @return mixed
    */
Creates a new Programas model by another data,
so user don't need to input all field from scratch.
If creation is successful, the browser will be redirected to the 'view' page.

@param mixed $id
@return mixed
Creates a new Programas model by another data so user don ' t need to input all field from scratch . If creation is successful the browser will be redirected to the ' view ' page . @param mixed $id @return mixed
public function actionSaveAsNew($id) {
        $model = new Programas();
        if (Yii::$app->request->post('_asnew') != '1') {
            $model = $this->findModel($id);
        }
        if ($model->loadAll(Yii::$app->request->post()) && $model->saveAll()) {
            return $this->redirect(['view', 'id' => $model->prg_id]);
        } else {
            return $this->render('saveAsNew', [
                'model' => $model,
            ]);
        }
    }
public function actionSaveAsNew ( $ id ) { $ model = new Programas ( ) ; if ( Yii :: $ app -> request -> post ( '_asnew' ) != '1' ) { $ model = $ this -> findModel ( $ id ) ; } if ( $ model -> loadAll ( Yii :: $ app -> request -> post ( ) ) && $ model -> saveAll ( ) ) { return $ this -> redirect ( [ 'view' , 'id' => $ model -> prg_id ] ) ; } else { return $ this -> render ( 'saveAsNew' , [ 'model' => $ model , ] ) ; } }
Creates a new Programas model by another data,
 so user don't need to input all field from scratch.
Creates a new Programas model by another data so user don ' t need to input all field from scratch .