views:

338

answers:

2

I'm just starting out with CakePHP, and I can't find any support for implementing an optimistic locking scheme. The closest I could find was a comment on this CakePHP blog post saying that it wasn't supported in June 2008.

Does anyone know if that has changed, or if someone has published an extension or a tutorial on how to implement it yourself?

For a description of optimistic locking, see this answer.

+4  A: 

Not in the Core, and after a quick google it doesn appear that anyone is sharing a behavior if they made one. That would be my suggested tactic.

Alexander Morland
I suspected a behavior was the way to go, thanks for the confirmation. If I get one working, I'll post a link here.
Don Kirkby
I second Alexander
Shiv
+1  A: 

In the book "Practical CakePHP Projects" on chapter 10 is some code given to make your own "Magic Fields". One of them is a field for optimistic locking. I haven't tried it yet, but it looks quite good actually.

Bertus Fredriksen
Thanks for the tip. I added a link to the book for others to follow. The book preview is actually missing the two pages from chapter 10 that talk about optimistic locking, but you can download the source code. I think I'll use some features like the way they use validation errors, but they seem to be updating the lock value on read, not on write. That seems wrong to me.
Don Kirkby