public function getDocument(DocumentManager $dm)
    {
        // Check identity map first, if its already in there just return it.
        $document = $dm->getUnitOfWork()->tryGetByIdentifier($this);
        if ($document !== false) {
            return $document;
        }

        $document = $dm->getProxyFactory()->getProxy($this->class->getName(), $this->getArray());
        $dm->getUnitOfWork()->registerManaged($document, $this, []);

        return $document;
    }
public function getDocument(DocumentManager $dm)
    {
        // Check identity map first, if its already in there just return it.
        $document = $dm->getUnitOfWork()->tryGetByIdentifier($this);
        if ($document !== false) {
            return $document;
        }

        $document = $dm->getProxyFactory()->getProxy($this->class->getName(), $this->getArray());
        $dm->getUnitOfWork()->registerManaged($document, $this, []);

        return $document;
    }
public function getDocument ( DocumentManager $ dm ) { // Check identity map first, if its already in there just return it. $ document = $ dm -> getUnitOfWork ( ) -> tryGetByIdentifier ( $ this ) ; if ( $ document !== false ) { return $ document ; } $ document = $ dm -> getProxyFactory ( ) -> getProxy ( $ this -> class -> getName ( ) , $ this -> getArray ( ) ) ; $ dm -> getUnitOfWork ( ) -> registerManaged ( $ document , $ this , [ ] ) ; return $ document ; }
Gets a reference to the target document without actually loading it.

If partial objects are allowed, this method will return a partial object
that only has its identifier populated. Otherwise a proxy is returned that
automatically loads itself on first access.

@param DocumentManager $dm

@return object The document reference.
Gets a reference to the target document without actually loading it .