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


PHP DocumentManager::getConfiguration方法代碼示例

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


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

示例1: testLuceneIndexing

 public function testLuceneIndexing()
 {
     $this->dm->getConfiguration()->addDesignDocument('lucene_users', 'Doctrine\\Tests\\ODM\\CouchDB\\Functional\\LuceneQueryDesignDoc', array());
     $query = $this->dm->createLuceneQuery('lucene_users', 'by_name');
     $response = $query->createDesignDocument();
     $user1 = new \Doctrine\Tests\Models\CMS\CmsUser();
     $user1->username = "beberlei";
     $user1->status = "active";
     $user1->name = "Benjamin";
     $user2 = new \Doctrine\Tests\Models\CMS\CmsUser();
     $user2->username = "lsmith";
     $user2->status = "active";
     $user2->name = "Lukas";
     $this->dm->persist($user1);
     $this->dm->persist($user2);
     $this->dm->flush();
     $query->setQuery("Lukas");
     try {
         $result = $query->execute();
     } catch (\Doctrine\CouchDB\HTTP\HTTPException $e) {
         if ($e->getCode() == 404) {
             $this->markTestSkipped("Lucene is not integrated");
         } else {
             throw $e;
         }
     }
     $this->assertEquals(1, count($result));
     foreach ($result as $user) {
         $this->assertEquals($user2->id, $user['id']);
         $this->assertEquals(1, $user['score']);
     }
     $query->setIncludeDocs(true)->setDocumentName('Doctrine\\Tests\\Models\\CMS\\CmsUser');
     $result = $query->execute();
     $this->assertSame($user2, $result[0]['doc']);
 }
開發者ID:kevinyien,項目名稱:couchdb-odm,代碼行數:35,代碼來源:LuceneQueryTest.php

示例2: testFindTypeValidation

 public function testFindTypeValidation()
 {
     // hackish: forcing the class metadata to be loaded for those two classes so that the alias mapper finds them
     $this->dm->getRepository($this->type);
     $this->dm->getRepository($this->type . '2');
     // --
     $this->dm->getConfiguration()->setValidateDoctrineMetadata(false);
     $user = $this->dm->find($this->type . '2', '/functional/user');
     $this->assertNotInstanceOf($this->type, $user);
     $this->dm->getConfiguration()->setValidateDoctrineMetadata(true);
     $this->setExpectedException('InvalidArgumentException');
     $this->dm->find($this->type, '/functional/user');
 }
開發者ID:nicam,項目名稱:phpcr-odm,代碼行數:13,代碼來源:BasicCrudTest.php


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