public function readRef($fieldName)
    {
        $oRef = $this->readNestedAttribute($fieldName);
        if (!\MongoDBRef::isRef($oRef)) {
            throw new InvalidReferenceException();
        }
        if (isset($this->dbRefs) && isset($this->dbRefs[$fieldName])) {
            $modelInstance = $this->instantiateModel($this->dbRefs[$fieldName]);
        } else if ($this->getDI()->has('mongoMapper')) {
            $modelInstance = $this->getDI()->get('mongoMapper')->resolveModel($oRef['$ref']);
        } else {
            return $oRef;
        }
        return forward_static_call(array($modelInstance, 'findById'), $oRef['$id']);
    }
public function readRef($fieldName)
    {
        $oRef = $this->readNestedAttribute($fieldName);
        if (!\MongoDBRef::isRef($oRef)) {
            throw new InvalidReferenceException();
        }
        if (isset($this->dbRefs) && isset($this->dbRefs[$fieldName])) {
            $modelInstance = $this->instantiateModel($this->dbRefs[$fieldName]);
        } else if ($this->getDI()->has('mongoMapper')) {
            $modelInstance = $this->getDI()->get('mongoMapper')->resolveModel($oRef['$ref']);
        } else {
            return $oRef;
        }
        return forward_static_call(array($modelInstance, 'findById'), $oRef['$id']);
    }
public function readRef ( $ fieldName ) { $ oRef = $ this -> readNestedAttribute ( $ fieldName ) ; if ( ! \ MongoDBRef :: isRef ( $ oRef ) ) { throw new InvalidReferenceException ( ) ; } if ( isset ( $ this -> dbRefs ) && isset ( $ this -> dbRefs [ $ fieldName ] ) ) { $ modelInstance = $ this -> instantiateModel ( $ this -> dbRefs [ $ fieldName ] ) ; } else if ( $ this -> getDI ( ) -> has ( 'mongoMapper' ) ) { $ modelInstance = $ this -> getDI ( ) -> get ( 'mongoMapper' ) -> resolveModel ( $ oRef [ '$ref' ] ) ; } else { return $ oRef ; } return forward_static_call ( array ( $ modelInstance , 'findById' ) , $ oRef [ '$id' ] ) ; }
Returns corresponding object indicated by MongoDBRef

@param $fieldName
@return mixed
@throws InvalidReferenceException
Returns corresponding object indicated by MongoDBRef