Reputation: 414
I have an entity with a descriptor and a count. I need to increment the count column and retrieve the value. I could just get the entity, increment the count, and persist it, but that would be susceptible to race conditions right? What would be the best way to do this? I would rather not use a native query.
Upvotes: 0
Views: 1131
Reputation: 11190
I think what you're looking for is Optimistic Locking. Doctrine will version your entity and throw a locking exception if you try to update it when it's out of date.
Upvotes: 2