예제 #1
0
 /**
  * Return the current element
  * @return EMongoDocument
  * @since v1.3.4
  */
 public function current()
 {
     $document = $this->_cursor->current();
     if (empty($document)) {
         return $document;
     }
     return $this->_model->populateRecord($document);
 }
예제 #2
0
 /**
  * (PHP 5 &gt;= 5.0.0)<br/>
  * Return the current element
  * @link http://php.net/manual/en/iterator.current.php
  * @return mixed Can return any type.
  */
 public function current()
 {
     $collection = clone $this->collectionInstance;
     $collection->writeAttributes((array) $this->cursor->current());
     if ($this->fields) {
         $collection->setCursorFields($this->fields);
     }
     if ($collection::isLazyLoadingEnabled()) {
         $proxyClass = ProxyBuilder::getLazyLoadingClass(get_class($collection), Di::getDefault());
         ProxyBuilder::assignProxyValues($proxyClass, $collection);
         $collection = $proxyClass;
     } else {
         $collection->map();
     }
     return $collection;
 }
예제 #3
0
파일: Cursor.php 프로젝트: jasny/db-mongo
 /**
  * Returns the current element
  * 
  * @return array|object
  */
 public function current()
 {
     $values = parent::current();
     if (isset($values) && isset($this->collection) && $this->collection->getDocumentClass()) {
         $values = $this->collection->asDocument($values, $this->lazy);
     }
     return $values;
 }
 public function current()
 {
     if ($this->collectionName === null) {
         return new $this->objectType(parent::current());
     } else {
         return new $this->objectType($this->collectionName, parent::current());
     }
 }
예제 #5
0
 /**
  * Gets the active record for the current row
  * @return EMongoDocument|mixed
  * @throws EMongoException
  */
 public function current()
 {
     if ($this->model === null) {
         return $this->current = $this->cursor->current();
     } else {
         return $this->current = $this->model->populateRecord($this->cursor->current(), true, $this->partial);
     }
 }
예제 #6
0
 /**
  * Returns the current file
  *
  * @return MongoGridFSFile - The current file.
  */
 public function current()
 {
     $current = parent::current();
     if (!$current) {
         return null;
     }
     return new MongoGridFSFile($this->gridfs, $current);
 }
예제 #7
0
 /**
  * {@inheritdoc}
  *
  * @return array|Document
  * @throws ODMException
  * @throws DefinitionException
  */
 public function current()
 {
     $fields = $this->cursor->current();
     if (empty($this->class)) {
         return $fields;
     }
     return $fields ? $this->odm->document($this->class, $fields) : null;
 }
예제 #8
0
 /**
  * Iterator::current
  * return current specific object
  *
  * @return MongoObject
  * @throws Exception
  */
 public function current()
 {
     $documentData = $this->myResultCursor->current();
     /** @var MongoObject $document */
     $document = $this->container->getInstanceOf($this->classMapInterface->getClassForResult($this->collection, $documentData));
     $document->setCollection($this->collection);
     $document->loadFromArray($documentData);
     return $document;
 }
예제 #9
0
파일: OdmCursor.php 프로젝트: irto/neomongo
 /**
  * Iterator interface current. Return a model object
  * with cursor document. (used in foreach)
  *
  * @return mixed
  */
 public function current()
 {
     $model = clone $this->model;
     $document = $this->cursor->current();
     if ($model->parseDocument($document)) {
         return $model;
     }
     return false;
 }
예제 #10
0
파일: Cursor.php 프로젝트: ne0h12/mongodb
 /**
  * Wrapper method for MongoCursor::current().
  *
  * @see http://php.net/manual/en/iterator.current.php
  * @see http://php.net/manual/en/mongocursor.current.php
  * @return array|null
  */
 public function current()
 {
     $current = $this->mongoCursor->current();
     if ($current instanceof \MongoGridFSFile) {
         $document = $current->file;
         $document['file'] = new GridFSFile($current);
         $current = $document;
     }
     return $current;
 }
예제 #11
0
 /**
  * @throws Exception\RuntimeException
  * @return void
  */
 public function rewind()
 {
     //        if ( $this -> statementMode == self::STATEMENT_MODE_FORWARD && $this -> position > 0 )
     //        {
     //            throw new Exception\RuntimeException(
     //            'This result is a forward only result set, calling rewind() after moving forward is not supported'
     //            );
     //        }
     $this->resource->rewind();
     $this->currentData = $this->resource->current();
     $this->currentComplete = true;
     $this->position = 0;
 }
예제 #12
0
 /**
  * Returns the document at the specified index as an object
  *
  * @since v1.0.0
  */
 public function row($index = 0, $class = NULL, $as_object = FALSE)
 {
     $size = $this->_cursor->count();
     $this->_cursor->reset();
     $res = array();
     for ($i = 0; $i < $size; $i++) {
         $this->_cursor->next();
         if ($i == $index && $index <= $size) {
             $res = $as_object ? (object) $this->_cursor->current() : $this->_cursor->current();
             break;
         }
     }
     return $res;
 }
예제 #13
0
 /**
  * Returns the current element
  *
  * @since   0.3.0
  *
  * See [\Iterator::current]
  *
  * @link    http://www.php.net/manual/en/mongocursor.current.php \MongoCursor::current
  *
  * @return  array
  */
 public function current()
 {
     $data = $this->cursor->current();
     if (isset($this->benchmark)) {
         // Stop the benchmark
         Profiler::stop($this->benchmark);
         // Clean benchmark token
         $this->benchmark = null;
     }
     if (!$this->model) {
         return $data;
     }
     $model = clone $this->model;
     return $model->loadValues($data ?: array(), true);
 }
예제 #14
0
 /**
  * @return Model
  */
 public function current()
 {
     return $this->load_model(parent::current());
 }
예제 #15
0
 /**
  * (PHP 5 &gt;= 5.0.0)<br/>
  * Return the current element
  * @link http://php.net/manual/en/iterator.current.php
  * @return mixed Can return any type.
  */
 public function current()
 {
     return $this->cursor->current();
 }
예제 #16
0
 /**
  * Returns the current element
  *
  * @return modelBase
  */
 public function current()
 {
     $modelClass = $this->modelClass;
     return new $modelClass($this->cursor->current());
 }
예제 #17
0
파일: Cursor.php 프로젝트: lisong/incubator
 public function current()
 {
     return new $this->className($this->collection, parent::current());
 }
예제 #18
0
 /**
  * Required for Iterator Interface
  * This function must be implemented in extended classes to provide the type
  * of document as a class
  * @return array
  */
 public function current()
 {
     $this->document = $this->cursor->current();
     return $this->document;
 }
예제 #19
0
 /**
  * Returns the current file
  *
  * @link http://php.net/manual/en/mongogridfscursor.current.php
  * @return MongoGridFSFile The current file
  */
 public function current()
 {
     $file = parent::current();
     return $file !== null ? new MongoGridFSFile($this->gridfs, $file) : null;
 }
예제 #20
0
 /**
  * {@inheritdoc}
  *
  * @return \SimpleMongo\Document
  */
 public function current()
 {
     return $this->objectFactory->unmarshal($this->mongoCursor->current());
 }
예제 #21
0
 /**
  * Returns the current Morph_Object
  * @return Morph_Object
  */
 public function current()
 {
     $current = $this->cursor->current();
     return $this->createObject($current);
 }
예제 #22
0
 /**
  * Iterator: current
  *
  * @return array|Mongo_Document
  */
 public function current()
 {
     $data = $this->_cursor->current();
     if (isset($this->_bm)) {
         $this->db()->profiler_stop($this->_bm);
         unset($this->_bm);
     }
     if (!$this->_model) {
         return $data;
     }
     $model = clone $this->get_model();
     return $model->load_values($data ? $data : array(), TRUE);
 }
예제 #23
0
 public function current()
 {
     $data = $this->cursor->current();
     return $data ? call_user_func($this->hydrator, $data) : false;
 }