private function createDocument(array $result, ?object $document = null, array $hints = []) : ?object
    {
        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);
    }
private function createDocument(array $result, ?object $document = null, array $hints = []) : ?object
    {
        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);
    }
private function createDocument ( array $ result , ? object $ document = null , array $ hints = [ ] ) : ? object { 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 ) ; }
Creates or fills a single document object from an query result.

@param array  $result   The query result.
@param object $document The document object to fill, if any.
@param array  $hints    Hints for document creation.

@return object|null The filled and managed document object or NULL, if the query result is empty.
Creates or fills a single document object from an query result .