I need to stop updating a specific value, even if they are set to a POST array. I use unsafe yii rules for this.
array('id', 'unsafe', 'on'=>'update'),
still with this, i cant miss the id from the update.
how can this be done with yii?
below is my function rules.
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.
$ models-> Save ();
source share