src/wcmf/lib/persistence/impl/RemoteCapablePersistenceFacade.php
protected function getProxyObject(ObjectId $umi, $buildDepth) {
    self::$logger->debug("Get proxy object for: ".$umi);

    // local objects don't have a proxy
    if (strlen($umi->getPrefix()) == 0) {
      return null;
    }

    // check if the proxy object was loaded already
    $proxy = $this->getRegisteredProxyObject($umi, $buildDepth);

    // search the proxy object if requested for the first time
    if (!$proxy) {
      $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
      $isRemoteCapableFacade = ($persistenceFacade instanceof RemoteCapablePersistenceFacadeImpl);
      $oldState = true;
      if ($isRemoteCapableFacade) {
        $oldState = $persistenceFacade->isResolvingProxies();
        $persistenceFacade->setResolveProxies(false);
      }
      $proxy = $persistenceFacade->loadFirstObject($umi->getType(), $buildDepth, [$umi->getType().'.umi' => $umi->toString()]);
      if ($isRemoteCapableFacade) {
        $persistenceFacade->setResolveProxies($oldState);
      }
      if (!$proxy) {
        // the proxy has to be created
        self::$logger->debug("Creating...");
        $proxy = $persistenceFacade->create($umi->getType(), BuildDepth::SINGLE);
        $proxy->setValue('umi', $umi);
        $proxy->save();
      }
      $this->registerProxyObject($umi, $proxy, $buildDepth);
    }
    self::$logger->debug("Proxy oid: ".$proxy->getOID());
    return $proxy;
  }
protected function getProxyObject(ObjectId $umi, $buildDepth) {
    self::$logger->debug("Get proxy object for: ".$umi);

    // local objects don't have a proxy
    if (strlen($umi->getPrefix()) == 0) {
      return null;
    }

    // check if the proxy object was loaded already
    $proxy = $this->getRegisteredProxyObject($umi, $buildDepth);

    // search the proxy object if requested for the first time
    if (!$proxy) {
      $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
      $isRemoteCapableFacade = ($persistenceFacade instanceof RemoteCapablePersistenceFacadeImpl);
      $oldState = true;
      if ($isRemoteCapableFacade) {
        $oldState = $persistenceFacade->isResolvingProxies();
        $persistenceFacade->setResolveProxies(false);
      }
      $proxy = $persistenceFacade->loadFirstObject($umi->getType(), $buildDepth, [$umi->getType().'.umi' => $umi->toString()]);
      if ($isRemoteCapableFacade) {
        $persistenceFacade->setResolveProxies($oldState);
      }
      if (!$proxy) {
        // the proxy has to be created
        self::$logger->debug("Creating...");
        $proxy = $persistenceFacade->create($umi->getType(), BuildDepth::SINGLE);
        $proxy->setValue('umi', $umi);
        $proxy->save();
      }
      $this->registerProxyObject($umi, $proxy, $buildDepth);
    }
    self::$logger->debug("Proxy oid: ".$proxy->getOID());
    return $proxy;
  }
protected function getProxyObject ( ObjectId $ umi , $ buildDepth ) { self :: $ logger -> debug ( "Get proxy object for: " . $ umi ) ; // local objects don't have a proxy if ( strlen ( $ umi -> getPrefix ( ) ) == 0 ) { return null ; } // check if the proxy object was loaded already $ proxy = $ this -> getRegisteredProxyObject ( $ umi , $ buildDepth ) ; // search the proxy object if requested for the first time if ( ! $ proxy ) { $ persistenceFacade = ObjectFactory :: getInstance ( 'persistenceFacade' ) ; $ isRemoteCapableFacade = ( $ persistenceFacade instanceof RemoteCapablePersistenceFacadeImpl ) ; $ oldState = true ; if ( $ isRemoteCapableFacade ) { $ oldState = $ persistenceFacade -> isResolvingProxies ( ) ; $ persistenceFacade -> setResolveProxies ( false ) ; } $ proxy = $ persistenceFacade -> loadFirstObject ( $ umi -> getType ( ) , $ buildDepth , [ $ umi -> getType ( ) . '.umi' => $ umi -> toString ( ) ] ) ; if ( $ isRemoteCapableFacade ) { $ persistenceFacade -> setResolveProxies ( $ oldState ) ; } if ( ! $ proxy ) { // the proxy has to be created self :: $ logger -> debug ( "Creating..." ) ; $ proxy = $ persistenceFacade -> create ( $ umi -> getType ( ) , BuildDepth :: SINGLE ) ; $ proxy -> setValue ( 'umi' , $ umi ) ; $ proxy -> save ( ) ; } $ this -> registerProxyObject ( $ umi , $ proxy , $ buildDepth ) ; } self :: $ logger -> debug ( "Proxy oid: " . $ proxy -> getOID ( ) ) ; return $ proxy ; }
Get the proxy object for a remote object.
This method makes sure that a proxy for the given remote object exists.
If it does not exist, it will be created.
@param $umi The universal model id (oid with server prefix)
@param $buildDepth buildDepth One of the BUILDDEPTH constants or a number describing the number of generations to build (except BuildDepth::REQUIRED)
@return The proxy object.
Get the proxy object for a remote object . This method makes sure that a proxy for the given remote object exists . If it does not exist it will be created .