Rules and saving in DB

Hi,

i remark a yii behave :

for example i have a model that contain

id -->int

name–>string

address–>string

in model’s rules, when i didn’t put a rule for the attribute “name” it will not be saved in DB.

I concluded that I must put inevitably a rule for every attrebute.

Is this a right behave of yii ?

note that i use yii 1.1.4

If you don’t want define rule for some fields, you can mark them as safe.

in rules add


array('name','safe')

you can also avoid rules, but this attribute will not be set with $model->attributes.

You can set each value manually, even without rules:

$model->myAttributeWithoutRules= ‘value’;