Yii Framework Forum: Help On Update Model With Composite Key - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Help On Update Model With Composite Key Rate Topic: -----

#1 User is offline   Led 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 200
  • Joined: 16-January 12

Posted 21 April 2013 - 01:36 PM

Hi cannot update a model that have composite key.

i'm using
            array('id_projeto+id_utilizador', 'application.extensions.uniqueMultiColumnValidator', 'message' => 'Utilizador já está associado a projeto'),


and when update id_project ,ok
when update id_utilizador or other field, i get the error message.

this is the action

public function actionUpdate($idproj,$iduser) {
        $model = $this->loadModel($idproj,$iduser);

        if (isset($_POST['UtilizadorProjeto'])) {
            $model->attributes = $_POST['UtilizadorProjeto'];            
            if ($model->save())
                $this->redirect(array('view', 'idproj' => $model->id_projeto,'iduser'=>$model->id_utilizador));
        }

        $this->render('update', array(
            'model' => $model,
        ));
    }

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users