We have twohree problems with this approach. All we want is to update the visits column, but the entire record will be updated. Also, if we didn't pass the false argument to the save method, all the validation process will be executed. Also if someone in parallel will update record from 4 to 5, we still save it as 5, as our version of post record have 4.
Since 1.1.8, the CActiveRecord class has a method that can help us with this task. It's the [CActiveRecord::saveCounters()] method and its usage is pretty simple: