psixojoker
(Psixojoker)
1
Hi.
I try
$user=User::model()->findByPk(5);
$user->balance+=2;
$user->save();
But, balance have write 2. Always. It doesn’t increase.
In other models, code above work perfectly.
What different and why i can not write variables in fields?
tomvdp
(Tomvdp)
2
Maybe some validation rule stops it ?
Try $user->save(false) to save without validation.
psixojoker
(Psixojoker)
3
Thanks for answer.
I solved this problem.
In User model was declarated defaultScopes(), and field balance don’t loaded in ActiveRecord.
Probably, in this case, can insert only constant values, without variables.