示例#1
0
 /**
  * @param array $document
  * @return array|object|null
  */
 private function hydrateDocument($document)
 {
     if ($document !== null && $this->hydrate) {
         return $this->unitOfWork->getOrCreateDocument($this->class->name, $document, $this->unitOfWorkHints);
     }
     return $document;
 }
示例#2
0
 /**
  * Creates or fills a single document object from an query result.
  *
  * @param object $result The query result.
  * @param object $document The document object to fill, if any.
  * @param array $hints Hints for document creation.
  * @return object The filled and managed document object or NULL, if the query result is empty.
  */
 private function createDocument($result, $document = null, array $hints = array())
 {
     if ($result === null) {
         return null;
     }
     if ($document !== null) {
         $hints[Query::HINT_REFRESH] = true;
         $id = $this->class->getPHPIdentifierValue($result['_id']);
         $this->uow->registerManaged($document, $id, $result);
     }
     return $this->uow->getOrCreateDocument($this->class->name, $result, $hints, $document);
 }