Skip to content

Commit

Permalink
Fixed #7028: Editing a participant in the CPD gives CDbException error
Browse files Browse the repository at this point in the history
  • Loading branch information
mennodekker committed Dec 6, 2012
1 parent c44dcb6 commit c2be07b
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions application/models/Participants.php
Expand Up @@ -141,20 +141,30 @@ function insertParticipant($data)
{
Yii::app()->db->createCommand()->insert('{{participants}}', $data);
}

/**
* Returns the primary key of this table
*
* @access public
* @return string
*/
public function primaryKey() {
return 'participant_id';
}

/*
/**
* This function updates the data edited in the jqgrid
* Parameters : data that is edited
* Return Data : None
*
* @param aray $data
*/

function updateRow($data)
{
Yii::app()->db->createCommand()
->update('{{participants}}',
$data,
'participant_id = :participant_id',
array(':participant_id'=>$data['participant_id']));
$record = $this->findByPk($data['participant_id']);
foreach ($data as $key => $value)
{
$record->$key = $value;
}
$record->save();
}

/*
Expand Down Expand Up @@ -230,7 +240,7 @@ function getParticipants($page, $limit,$attid, $order = null, $search = null, $u
$data = $this->getParticipantsSelectCommand(false, $attid, $search, $userid, $page, $limit, $order);

$allData = $data->queryAll();

return $allData;
}

Expand Down

0 comments on commit c2be07b

Please sign in to comment.