當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DocumentManager::getProxyFactory方法代碼示例

本文整理匯總了PHP中Doctrine\ODM\PHPCR\DocumentManager::getProxyFactory方法的典型用法代碼示例。如果您正苦於以下問題:PHP DocumentManager::getProxyFactory方法的具體用法?PHP DocumentManager::getProxyFactory怎麽用?PHP DocumentManager::getProxyFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\ODM\PHPCR\DocumentManager的用法示例。


在下文中一共展示了DocumentManager::getProxyFactory方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createProxy

 /**
  * Create a proxy instance or return an existing document
  *
  * @param $targetId
  * @param $className
  *
  * @return object
  */
 private function createProxy($targetId, $className)
 {
     $document = $this->getDocumentById($targetId);
     // check if referenced document already exists
     if ($document) {
         return $document;
     }
     $proxyDocument = $this->dm->getProxyFactory()->getProxy($className, $targetId);
     // register the document under its own id
     $this->registerDocument($proxyDocument, $targetId);
     return $proxyDocument;
 }
開發者ID:nicam,項目名稱:phpcr-odm,代碼行數:20,代碼來源:UnitOfWork.php

示例2: getOrCreateProxy

 /**
  * Get the existing document or proxy for this id of this class, or create
  * a new one.
  *
  * @param string $targetId
  * @param string $className
  * @param string $locale
  *
  * @return object
  */
 public function getOrCreateProxy($targetId, $className, $locale = null)
 {
     $document = $this->getDocumentById($targetId);
     // check if referenced document already exists
     if ($document) {
         $metadata = $this->dm->getClassMetadata($className);
         if ($locale && $locale !== $this->getCurrentLocale($document, $metadata)) {
             $this->doLoadTranslation($document, $metadata, $locale, true);
         }
         return $document;
     }
     $metadata = $this->dm->getClassMetadata($className);
     $proxyDocument = $this->dm->getProxyFactory()->getProxy($className, array($metadata->identifier => $targetId));
     // register the document under its own id
     $this->registerDocument($proxyDocument, $targetId);
     if ($locale) {
         $this->setLocale($proxyDocument, $this->dm->getClassMetadata($className), $locale);
     }
     return $proxyDocument;
 }
開發者ID:nikophil,項目名稱:cmf-tests,代碼行數:30,代碼來源:UnitOfWork.php


注:本文中的Doctrine\ODM\PHPCR\DocumentManager::getProxyFactory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。