Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-2864

New type of lock: OPTIMISTIC_FORCE_INCREMENT

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      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: OPTIMISTIC_FORCE_INCREMENT. 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.

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

        Issue Links

          Activity

          Hide
          dhager Darien Hager added a comment - - edited

          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() .

          Show
          dhager Darien Hager added a comment - - edited 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() .

            People

            • Assignee:
              beberlei Benjamin Eberlei
              Reporter:
              szjani Szurovecz János
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: