Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-683

EntityManager#lock() on unitialized proxy coudl be optimized

    Details

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

      Description

      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?

        Issue Links

          Activity

          Hide
          Benjamin Eberlei added a comment -

          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!
                  }
                  ...
              }
          
          Show
          Benjamin Eberlei added a comment - 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! } ... }

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Benjamin Eberlei
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: