/** @override */ public function current() { $current = $this->mongoCursor->current(); if ($current && $this->hydrate) { return $this->unitOfWork->getOrCreateDocument($this->class->name, $current, $this->hints); } return $current ? $current : null; }
/** * Loads data for a document id refreshing and overriding any local values * if the document already exists in the identity map. * * @param string $documentName The document name to load. * @param string $id The id of the document being loaded. * @param string $data The data to load into the document. * @return object $document The loaded document. */ public function load($documentName, $id, $data) { if ($data !== null) { $hints = array(Query::HINT_REFRESH => Query::HINT_REFRESH); return $this->_unitOfWork->getOrCreateDocument($documentName, $data, $hints); } return false; }
/** * Lood document by its identifier. * * @param string $id * @return object|null */ public function loadById($id) { $result = $this->_collection->findOne(array('_id' => new \MongoId($id))); if ($result !== null) { return $this->_uow->getOrCreateDocument($this->_documentName, $result); } return null; }
/** @override */ public function getNext() { $next = parent::getNext(); if ($next && $this->hydrate) { return $this->unitOfWork->getOrCreateDocument($this->class->name, $next, $this->hints); } return $next ? $next : null; }
public function current() { $this->initialize(); $current = current($this->data); if ($current && $this->hydrate) { return $this->unitOfWork->getOrCreateDocument($this->class->name, $current, $this->hints); } return $current ? $current : null; }