Skip to content


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

doctrinebot opened this Issue · 2 comments

2 participants


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?


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!
@beberlei beberlei was assigned by doctrinebot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.