i need to stop updating certain value even those are set to POST array. to do that i am using unsafe in yii rules.
array('id', 'unsafe', 'on'=>'update'),
still with this, i am unable to skip the id from updating.
how can this be done with yii?
below is my rules function..
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('name, body, created_date', 'required'),
array('name', 'length', 'max'=>128),
array('body', 'length', 'max'=>512),
array('id', 'unsafe', 'on'=>'update'),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
array('id, name, body, created_date', 'safe', 'on'=>'search'),
);
}
Update 1
$model->attributes = $_POST['User'];
and i need when saving, to skip certain attributes.
$model->save();