DDC-2864: New type of lock: OPTIMISTIC_FORCE_INCREMENT #3620

doctrinebot opened this Issue Dec 18, 2013 · 2 comments

2 participants


Jira issue originally created by user szjani:

When optimistick locking is being used, the version field is incremented after the update only if the entity itself has been modified. In Domain-Driven Design another kind of locking mechanism is essential: OPTIMISTICFORCEINCREMENT. It means that the version field is always incremented after an update. The lack of this feaure can be realized when only the aggregate root has a version field and some other parts of the aggregate is being modified.

PESSIMISTICFORCEINCREMENT is also an interesting lock type which might be useful as well.


Comment created by dhager:

I'm having this same issue, although I'm not certain a new locking-type is the answer.

Basically, I want to ensure that an entity gets updated with a new version integer/timestamp, whether or not anything "real" has been changed on it. It seems the only workaround is to designate a "junk" property and change that, which isn't particularly elegant.

The problem with a locking-type is that individual entities can't signal that they need incrementing without having a reference to the entity-manager so that they can $em->lock() .

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment