Understanding Cactiverecord::saveattributes()

Hi,

In definition parameters of CActiveRecord:saveAttributes($array attributes) coming:

What’s the mean of this statement: [b]If the latter, the record’s attribute will be changed accordingly before saving. ???

[/b]

Two examples doing the same:




$model->attribute = 'new value';

$model->saveAttributes(array('attribute'));






$model->saveAttributes(array('attribute'=>'new value'));



I know it. what’s mean of this statement: If the latter, the record’s attribute will be changed [color="#FF0000"]accordingly before saving. [/color]

The values passes in the argument will be assigned to attributes matching keys and then they will be saved.

That’s why it’s ‘before being saved’. Because they are first assigned and then saved.