当前位置: 首页>>代码示例>>PHP>>正文


PHP MongoDBException::documentNotMappedToCollection方法代码示例

本文整理汇总了PHP中Doctrine\ODM\MongoDB\MongoDBException::documentNotMappedToCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoDBException::documentNotMappedToCollection方法的具体用法?PHP MongoDBException::documentNotMappedToCollection怎么用?PHP MongoDBException::documentNotMappedToCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\ODM\MongoDB\MongoDBException的用法示例。


在下文中一共展示了MongoDBException::documentNotMappedToCollection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDocumentCollection

 /**
  * Returns the MongoCollection instance for a class.
  *
  * @param string $className The class name.
  * @return Doctrine\ODM\MongoDB\MongoCollection
  */
 public function getDocumentCollection($className)
 {
     $metadata = $this->_metadataFactory->getMetadataFor($className);
     $collection = $metadata->getCollection();
     $db = $metadata->getDB();
     $key = $db . '.' . $collection;
     if ($collection && !isset($this->_documentCollections[$key])) {
         if ($metadata->isFile()) {
             $collection = $this->getDocumentDB($className)->getGridFS($collection);
         } else {
             $collection = $this->getDocumentDB($className)->selectCollection($collection);
         }
         $mongoCollection = new MongoCollection($collection, $metadata, $this);
         $this->_documentCollections[$key] = $mongoCollection;
     }
     if (!isset($this->_documentCollections[$key])) {
         throw MongoDBException::documentNotMappedToCollection($className);
     }
     return $this->_documentCollections[$key];
 }
开发者ID:bzarzuela,项目名称:Doctrine-2-Blog-Example,代码行数:26,代码来源:DocumentManager.php

示例2: getDocumentCollection

 /**
  * Returns the MongoCollection instance for a class.
  *
  * @param string $className The class name.
  * @return Doctrine\MongoDB\Collection
  */
 public function getDocumentCollection($className)
 {
     $metadata = $this->metadataFactory->getMetadataFor($className);
     $db = $metadata->getDatabase();
     $collection = $metadata->getCollection();
     if (!$collection) {
         throw MongoDBException::documentNotMappedToCollection($className);
     }
     $db = $this->getDocumentDatabase($className);
     if ($metadata->isFile()) {
         $collection = $db->getGridFS($collection);
     } else {
         $collection = $db->selectCollection($collection);
     }
     return $collection;
 }
开发者ID:hirocaster,项目名称:mongodb-odm,代码行数:22,代码来源:DocumentManager.php

示例3: getDocumentCollection

 /**
  * Returns the MongoCollection instance for a class.
  *
  * @param string $className The class name.
  * @return \Doctrine\MongoDB\Collection
  */
 public function getDocumentCollection($className)
 {
     $metadata = $this->metadataFactory->getMetadataFor($className);
     $collection = $metadata->getCollection();
     if (!$collection) {
         throw MongoDBException::documentNotMappedToCollection($className);
     }
     $db = $this->getDocumentDatabase($className);
     if (!isset($this->documentCollections[$className])) {
         if ($metadata->isFile()) {
             $this->documentCollections[$className] = $db->getGridFS($collection);
         } else {
             $this->documentCollections[$className] = $db->selectCollection($collection);
         }
     }
     $collection = $this->documentCollections[$className];
     if (isset($metadata->slaveOkay)) {
         $collection->setSlaveOkay($metadata->slaveOkay);
     }
     return $this->documentCollections[$className];
 }
开发者ID:noikiy,项目名称:inovi,代码行数:27,代码来源:DocumentManager.php

示例4: getDocumentCollection

 /**
  * Returns the MongoCollection instance for a class.
  *
  * @param string $className The class name.
  * @throws MongoDBException When the $className param is not mapped to a collection
  * @return \Doctrine\MongoDB\Collection
  */
 public function getDocumentCollection($className)
 {
     $className = ltrim($className, '\\');
     $metadata = $this->metadataFactory->getMetadataFor($className);
     $collectionName = $metadata->getCollection();
     if (!$collectionName) {
         throw MongoDBException::documentNotMappedToCollection($className);
     }
     if (!isset($this->documentCollections[$className])) {
         $db = $this->getDocumentDatabase($className);
         $this->documentCollections[$className] = $metadata->isFile() ? $db->getGridFS($collectionName) : $db->selectCollection($collectionName);
     }
     $collection = $this->documentCollections[$className];
     if ($metadata->slaveOkay !== null) {
         $collection->setSlaveOkay($metadata->slaveOkay);
     }
     return $this->documentCollections[$className];
 }
开发者ID:backplane,项目名称:mongodb-odm,代码行数:25,代码来源:DocumentManager.php


注:本文中的Doctrine\ODM\MongoDB\MongoDBException::documentNotMappedToCollection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。