DDC-683: EntityManager#lock() on unitialized proxy coudl be optimized #838

Open
opened 2026-01-22 12:52:14 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Jul 10, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @beberlei:

If you call lock() on an unitiialized proxy, it would be possible to combine the fetch and lock in one operation. Is this feasible from a technical / workflow perspsective?

Originally created by @doctrinebot on GitHub (Jul 10, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @beberlei: If you call lock() on an unitiialized proxy, it would be possible to combine the fetch and lock in one operation. Is this feasible from a technical / workflow perspsective?
admin added the New Feature label 2026-01-22 12:52:14 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jul 10, 2010):

@doctrinebot commented on GitHub (Jul 10, 2010): - relates to [DDC-681: PATCH: UnitOfWork#lock locks by column names instead of field names](http://www.doctrine-project.org/jira/browse/DDC-681)
Author
Owner

@doctrinebot commented on GitHub (Jul 21, 2010):

Comment created by @beberlei:

Ok this is what refresh() with LOCK support is actually needed for:

    public function lock($entity, $lockMode, $lockVersion = null)
    {
        if ($this->getEntityState($entity) != self::STATE_MANAGED) {
            throw new InvalidArgumentException("Entity is not MANAGED.");
        } else if ($entity instanceof Proxy && $entity->*_isInitialized_*) {
            $this->refresh(....); // with LOCK!
        }
        ...
    }
@doctrinebot commented on GitHub (Jul 21, 2010): Comment created by @beberlei: Ok this is what refresh() with LOCK support is actually needed for: ``` public function lock($entity, $lockMode, $lockVersion = null) { if ($this->getEntityState($entity) != self::STATE_MANAGED) { throw new InvalidArgumentException("Entity is not MANAGED."); } else if ($entity instanceof Proxy && $entity->*_isInitialized_*) { $this->refresh(....); // with LOCK! } ... } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#838