本文整理匯總了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);
}
示例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)));
}
示例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();
}
示例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);
}
示例5: refresh
/**
* @param object $document
* @return object Document instance
*/
public function refresh($document)
{
return $this->dm->refresh($document);
}