[PR #1456] No-frills support for Entity version bumping #9515

Closed
opened 2026-01-22 16:04:32 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/1456

State: closed
Merged: No


A cut-down version of DDC-3640 / PR #1378

This PR focuses on the "support code", and does not contain any annotations or other mechanisms for knowing when an entity's version should be bumped in the absence of "direct" modifications. Instead, it mimics other insert/update features with the methods:

$em->lock($entity,LockMode::OPTIMISTIC_FORCE_INCREMENT); // Preferred usage

$unitOfWork->lock($entity,LockMode::OPTIMISTIC_FORCE_INCREMENT); 
$unitOfWork->scheduleForVersionBump($entity,$enable); // For internal usage
$unitOfWork->isScheduledForVersionBump($entity);      // For internal usage
$unitOfWork->getScheduledEntityVersionBumps();        // For internal usage

These simple calls will allow users to solve tricky use-cases right now with their own custom event-listener code, and serve as a foundation for when DDC-3781 eventually defines an officially-sanctioned method.

Depends on doctrine/dbal#905

**Original Pull Request:** https://github.com/doctrine/orm/pull/1456 **State:** closed **Merged:** No --- A cut-down version of DDC-3640 / PR #1378 This PR focuses on the "support code", and does not contain any annotations or other mechanisms for knowing _when_ an entity's version should be bumped in the absence of "direct" modifications. Instead, it mimics other insert/update features with the methods: ``` $em->lock($entity,LockMode::OPTIMISTIC_FORCE_INCREMENT); // Preferred usage $unitOfWork->lock($entity,LockMode::OPTIMISTIC_FORCE_INCREMENT); $unitOfWork->scheduleForVersionBump($entity,$enable); // For internal usage $unitOfWork->isScheduledForVersionBump($entity); // For internal usage $unitOfWork->getScheduledEntityVersionBumps(); // For internal usage ``` These simple calls will allow users to solve tricky use-cases right now with their own custom event-listener code, and serve as a foundation for when DDC-3781 eventually defines an officially-sanctioned method. Depends on doctrine/dbal#905
admin added the pull-request label 2026-01-22 16:04:32 +01:00
admin closed this issue 2026-01-22 16:04:33 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9515