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


PHP DocumentManager::refresh方法代碼示例

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


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

示例1: testRefreshDetached

 /**
  * @expectedException \Doctrine\ODM\PHPCR\Exception\InvalidArgumentException
  */
 public function testRefreshDetached()
 {
     $user = new CmsUser();
     $user->id = '/functional/Guilherme';
     $user->username = 'gblanco';
     $this->dm->refresh($user);
 }
開發者ID:steffenbrem,項目名稱:phpcr-odm,代碼行數:10,代碼來源:RefreshTest.php

示例2: renderArticleLocale

 /**
  * @param  \ServerGrove\KbBundle\Document\Article $article
  * @param  string                                 $locale
  * @return string
  */
 public function renderArticleLocale(Article $article, $locale)
 {
     try {
         $active = $this->manager->findTranslation(get_class($article), $article->getId(), $locale, false)->getIsActive();
     } catch (\InvalidArgumentException $e) {
         $active = false;
     }
     $this->manager->refresh($article);
     return $this->twig->renderBlock('article_locale', array('active' => $active, 'locale' => $locale, 'locale_name' => Locale::getDisplayLanguage($locale)));
 }
開發者ID:Cohros,項目名稱:KnowledgeBase,代碼行數:15,代碼來源:ArticleExtension.php

示例3: testCascadeManagedDocumentReferrerMtoMDuringFlush

 /**
  * Test Referrers ManyToMany cascade Flush
  */
 public function testCascadeManagedDocumentReferrerMtoMDuringFlush()
 {
     $article1 = new \Doctrine\Tests\Models\CMS\CmsArticle();
     $article1->text = "foo";
     $article1->topic = "bar";
     $article1->id = '/functional/article_m2m_referrer_1';
     $this->dm->persist($article1);
     $article2 = new \Doctrine\Tests\Models\CMS\CmsArticle();
     $article2->text = "foo2";
     $article2->topic = "bar2";
     $article2->id = '/functional/article_m2m_referrer_2';
     $this->dm->persist($article2);
     $superman = new \Doctrine\Tests\Models\CMS\CmsArticlePerson();
     $superman->name = "superman";
     $this->dm->persist($superman);
     $article1->addPerson($superman);
     $this->dm->flush();
     $this->dm->refresh($superman);
     $this->assertEquals($superman, $article1->getPersons()->first());
     // we want to attach article2 to superman
     // in the form of edition, we will submit article1 and article2 at the same time
     $superman->getArticlesReferrers()->add($article1);
     $superman->getArticlesReferrers()->add($article2);
     $this->dm->flush();
     $this->dm->refresh($superman);
     $this->assertEquals(1, $article1->getPersons()->count());
     $this->assertEquals(2, $superman->getArticlesReferrers()->count());
     $this->dm->clear();
 }
開發者ID:steffenbrem,項目名稱:phpcr-odm,代碼行數:32,代碼來源:CascadePersistTest.php

示例4: restoreVersion

 /**
  * Restore the document to the state it was before
  *
  * @param string  $documentVersion the version name to restore
  * @param boolean $removeExisting  how to handle identifier collisions
  *
  * @see VersionManager::restore
  */
 public function restoreVersion($documentVersion, $removeExisting)
 {
     $oid = spl_object_hash($documentVersion);
     $history = $this->documentHistory[$oid];
     $version = $this->documentVersion[$oid];
     $document = $this->dm->find(null, $history->getVersionableIdentifier());
     $vm = $this->session->getWorkspace()->getVersionManager();
     $vm->restore($removeExisting, $version);
     $this->dm->refresh($document);
 }
開發者ID:nikophil,項目名稱:cmf-tests,代碼行數:18,代碼來源:UnitOfWork.php

示例5: refresh

 /**
  * @param  object $document
  * @return object Document instance
  */
 public function refresh($document)
 {
     return $this->dm->refresh($document);
 }
開發者ID:richardmiller,項目名稱:phpcr-odm,代碼行數:8,代碼來源:DocumentRepository.php


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