Ejemplo n.º 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);
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
0
 /**
  * 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());
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 9
0
 /**
  * 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;
 }
Ejemplo n.º 10
0
 /**
  * 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 14
0
 /**
  * @return Model
  */
 public function current()
 {
     return $this->load_model(parent::current());
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 16
0
 /**
  * Returns the current element
  *
  * @return modelBase
  */
 public function current()
 {
     $modelClass = $this->modelClass;
     return new $modelClass($this->cursor->current());
 }
Ejemplo n.º 17
0
 public function current()
 {
     return new $this->className($this->collection, parent::current());
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 20
0
 /**
  * {@inheritdoc}
  *
  * @return \SimpleMongo\Document
  */
 public function current()
 {
     return $this->objectFactory->unmarshal($this->mongoCursor->current());
 }
Ejemplo n.º 21
0
 /**
  * Returns the current Morph_Object
  * @return Morph_Object
  */
 public function current()
 {
     $current = $this->cursor->current();
     return $this->createObject($current);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 23
0
 public function current()
 {
     $data = $this->cursor->current();
     return $data ? call_user_func($this->hydrator, $data) : false;
 }