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


PHP MongoCursor::getNext方法代碼示例

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


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

示例1: getNext

 /**
  * Retrieve the collection object (as provided by x::find())
  * @return Collection
  */
 public function getNext()
 {
     $item = $this->cursor->getNext();
     $obj = clone $this->collection;
     $obj->populate($item);
     return $obj;
 }
開發者ID:rogerthomas84,項目名稱:ohdm,代碼行數:11,代碼來源:Cursor.php

示例2: getNext

 /**
  * Get next doc in cursor
  * @return EMongoDocument|null
  */
 public function getNext()
 {
     if ($c = $this->cursor->getNext()) {
         return $this->current = $this->model->populateRecord($c, true, $this->partial);
     }
     return null;
 }
開發者ID:sammaye,項目名稱:mongoyii-php7,代碼行數:11,代碼來源:Cursor.php

示例3: initializeNextItem

 /**
  * Ensures that the <code>next</code> points to the correct item, possibly reading from the dbCursor.
  */
 private function initializeNextItem()
 {
     while (!$this->messagesToReturn->valid() && $this->dbCursor->hasNext()) {
         $cb = $this->callback;
         $this->messagesToReturn = new \ArrayIterator($cb($this->dbCursor->getNext(), $this->actualAggregateIdentifier));
     }
     $this->next = $this->messagesToReturn->current();
     $this->messagesToReturn->next();
 }
開發者ID:fcm,項目名稱:GovernorFramework,代碼行數:12,代碼來源:CursorBackedDomainEventStream.php

示例4: next

 /**
  * Query termination method (Will execute the query)
  * @return mixed
  */
 public function next()
 {
     if (!$this->_Cursor) {
         $this->_do_query();
     }
     if ($this->_Cursor && $this->_Cursor->hasNext()) {
         $document = $this->_Cursor->getNext();
         $this->_callback($document);
         return $document;
     }
 }
開發者ID:alex-robert,項目名稱:knot,代碼行數:15,代碼來源:Findr.php

示例5: as_array

 public function as_array($key = null, $value = null)
 {
     $return_value = array();
     while ($data = parent::getNext()) {
         if ($key === null && $value === null) {
             $return_value[] = $this->load_model($data);
         } elseif ($key === null) {
             if (array_key_exists($value, $data)) {
                 $return_value[] = $data[$value];
             }
         } elseif ($value === null) {
             if (array_key_exists($key, $data)) {
                 $return_value[$data[$key]] = $this->load_model($data);
             }
         } else {
             if (array_key_exists($key, $data) && array_key_exists($value, $data)) {
                 $return_value[(string) $data[$key]] = $data[(string) $value];
             }
         }
     }
     return $return_value;
 }
開發者ID:doorframework,項目名稱:core,代碼行數:22,代碼來源:Cursor.php

示例6: fetchRowsInternal

 /**
  * @param \MongoCursor $cursor Mongo cursor instance to fetch data from.
  * @param boolean $all whether to fetch all rows or only first one.
  * @param string|callable $indexBy value to index by.
  * @return array|boolean result.
  * @see Query::fetchRows()
  */
 protected function fetchRowsInternal($cursor, $all, $indexBy)
 {
     $result = [];
     if ($all) {
         foreach ($cursor as $row) {
             $result[] = $row;
         }
     } else {
         if ($row = $cursor->getNext()) {
             $result = $row;
         } else {
             $result = false;
         }
     }
     return $result;
 }
開發者ID:aayaresko,項目名稱:yii2-extended-mongodb,代碼行數:23,代碼來源:Query.php

示例7: fetchRowsInternal

 /**
  * @param \MongoCursor $cursor Mongo cursor instance to fetch data from.
  * @param boolean $all whether to fetch all rows or only first one.
  * @param string|callable $indexBy value to index by.
  * @return array|boolean result.
  * @see Query::fetchRows()
  */
 protected function fetchRowsInternal($cursor, $all, $indexBy)
 {
     $result = [];
     if ($all) {
         foreach ($cursor as $row) {
             if ($indexBy !== null) {
                 if (is_string($indexBy)) {
                     $key = $row[$indexBy];
                 } else {
                     $key = call_user_func($indexBy, $row);
                 }
                 $result[$key] = $row;
             } else {
                 $result[] = $row;
             }
         }
     } else {
         if ($cursor->hasNext()) {
             $result = $cursor->getNext();
         } else {
             $result = false;
         }
     }
     return $result;
 }
開發者ID:howq,項目名稱:yii2,代碼行數:32,代碼來源:Query.php

示例8: setCursor

 /**
  *  Set Cursor
  *
  *  This method receive a MongoCursor and make
  *  it iterable. 
  *
  *  @param MongoCursor $obj 
  *
  *  @return void
  */
 protected final function setCursor(MongoCursor $obj)
 {
     $this->_cursor = $obj;
     $obj->reset();
     $this->setResult($obj->getNext());
 }
開發者ID:284099857,項目名稱:ActiveMongo,代碼行數:16,代碼來源:ActiveMongo.php

示例9: getNext

 /**
  * getNext.
  */
 public function getNext()
 {
     $this->logQuery();
     return parent::getNext();
 }
開發者ID:hybr,項目名稱:jpm,代碼行數:8,代碼來源:LoggableMongoCursor.php

示例10: instantiateRecordClass

 /**
  * Assign every retrived record with collection's recordClass.
  *
  * @param \MongoCursor $cursor
  */
 private function instantiateRecordClass(\MongoCursor $cursor)
 {
     $recordClass = $this->recordClass();
     switch ($recordClass) {
         case null:
             while ($cursor->hasNext()) {
                 (yield $cursor->getNext());
             }
             break;
         default:
             while ($cursor->hasNext()) {
                 (yield new $recordClass($cursor->getNext()));
             }
             break;
     }
 }
開發者ID:serkin,項目名稱:mongoob,代碼行數:21,代碼來源:AbstractCollection.php

示例11: getNext

 /**
  * Return the next object to which this cursor points, and advance the cursor
  *
  * @throws \MongoConnectionException
  * @throws \MongoCursorTimeoutException
  * @return modelBase Returns the next object
  */
 public function getNext()
 {
     $modelClass = $this->modelClass;
     $item = $this->cursor->getNext();
     return isset($item) ? new $modelClass($item) : null;
 }
開發者ID:mpcmf,項目名稱:mpcmf-core,代碼行數:13,代碼來源:modelCursor.php

示例12: getNext

 /**
  * Return the next file to which this cursor points, and advance the cursor
  *
  * @return MongoGridFSFile - Returns the next file.
  */
 public function getNext()
 {
     parent::getNext();
     return $this->current();
 }
開發者ID:Wynncraft,項目名稱:mongofill,代碼行數:10,代碼來源:MongoGridFSCursor.php

示例13: getNext

 /**
  * 獲取下一個值,並且把遊標移動
  * @return Array
  */
 public function getNext()
 {
     return $this->oMongoCursor->getNext();
 }
開發者ID:diandengs,項目名稱:RechoPHP,代碼行數:8,代碼來源:class.Mumongo.php


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