Hello,
I noticed that my models now saving attributes not listed in safe validator.
Something changed and now default is safe ?
Is the way to set default safe or unsafe ?
Hello,
I noticed that my models now saving attributes not listed in safe validator.
Something changed and now default is safe ?
Is the way to set default safe or unsafe ?
Check the documentation - http://www.yiiframework.com/doc/guide/1.1/en/form.model#declaring-safe-attributes
ok, I added new column to table and its not listed in any validtaor, but $model->save() saving it with no problem.
How do you assign a value to that field?
"Safe" attributes are considered/used only for the "massive assignement"… not for saving…
read this part of the doc - http://www.yiiframew…te-assignments.
if(isset($_POST['Product']))
{
$model->attributes=$_POST['Product'];
if($model->save()) {
Yii::app()->user->setFlash('success',"Ok");
$this->redirect(array('update','id'=>$model->id));
}
}