Skip to content

Commit

Permalink
#203 - added the object locking and versioning section to the README
Browse files Browse the repository at this point in the history
  • Loading branch information
alphadevx committed Sep 17, 2015
1 parent 3d81fb0 commit ba7e74c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,14 @@ Alpha supports database transactions via a number of static methods on the _Acti

### Object locking and versioning

TODO
Each active record in Alpha maintains a version number that is automatically incremented each time the record is saved. In order to prevent race conditions when two or more seperate threads attempt to save the same record, a version check is performed pre-save and if the version number being saved is older than the version currently in the database, a _Alpha\Exception\LockingException_ is thrown. Naturally in your application, you should capture that exception an try to handle it gracefully:

try {
$record->save();
} catch (LockingException $e) {
// Reload updated record from the database, display something useful to the user and
// then let them try to save the record again...
}

### History

Expand Down

0 comments on commit ba7e74c

Please sign in to comment.