How To Maintain The Data Concurrency In Active Record

Hi,

The scenario is, I have the Profile of user, who logged in to application and editing the his information.

User opened the profile in edit mode, and changing the details on browser, but meanwhile the administrator changed the some information of user.

So, when user change there information and submit the update form, it will override the changes done by the administrator.

I tried to implement this, from url http://learnyii.blogspot.in/2012/04/yii-concurrency-optimistic-control.html

but, it is not working… So how can we maintain the Data Concurrency during update the record.

Can we make it as core of active record in Yii.

Thanks,

Gaurish

If changes happen with more delay?

For example, now I (administrator) modify email field. Then, after 10 minutes, the user change the same field.

Is this change possible?

Because i think that concurrency changes are a relative concept in web scenario.

well… when user updates the data, user refers the the early data & make changed on that… so delay is not a factor here,…

when concurrent user updates any data… … they actually refers the data they see…

but admin or other user changes data, the reference changed… so we need show the changed data to user…

how can we achieve this in active record…??

If you want implement this, i think that when you are in edit mode, you should check (via ajax)

if some field has been modify from last time.

You can achieve this making hash of all field that you want monitor.