当前位置: 首页>>代码示例>>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;未经允许,请勿转载。