Some Way To Update Only The Chanched Form Fields.

Hi,

Maybe declare a new property like:




public $changedAttributes = array();



then when doing:




$model = new MyModel;

$model->attributes = $_POST['MyModel'];



on CActiveRecord::setAttributes only have to check if value is equal, if it is not equal add that attribute to $changedAttributes.

than user only have to do:




$model->update($model->changedAttributes);



It’s builtin in Yii2 AR.

Nice :)

Thanks.