Get reference to document

@throws Exception
@return array
343732
public function createReference()
    {
        $documentId = $this->getId();
        if (null === $documentId) {
            throw new Exception('Document must be stored to get DBRef');
        }

        return $this
            ->getCollection()
            ->getMongoCollection()
            ->createDBRef($documentId);
    }
216379
public function getOne($collection = "")
		{
			if (empty($collection)) {
				throw new Exception("In order to retrieve documents from MongoDB you must provide a collection name.");
			}

			$returns = $this->db->{$collection}->findOne($this->wheres, $this->selects);

			$this->_clear();

			return $returns;
		}
263577
public function getDocumentChangeSet($document)
    {
        $oid = spl_object_hash($document);
        if (isset($this->documentChangeSets[$oid])) {
            return $this->documentChangeSets[$oid];
        }
        return array();
    }
192228
public function getNomeDocumento()
    {
        if (!$this->getDocumento()) {
            return $this->getNome();
        } else {
            return $this->getNome() . ' / ' . $this->getTipoDocumento() . ': ' . $this->getDocumento();
        }
    }
1012741
public function getDocumentation()
    {
        $documentation = null;
        $documentationNodes = $this->element->getElementsByTagName('documentation');
        if ($documentationNodes->length > 0) {
            $documentation = $documentationNodes->item(0)->nodeValue;
        }
        return $documentation;
    }
541402
public function getDocumentData()
    {
        // If the model contain a buildDocument function
        // use it to build the document
        if (method_exists($this, 'buildDocument')) {
            $document = $this->buildDocument();

            return $document;
        }
        // If a searchable array is provided build
        // the document from the given array
        elseif (is_array($this->searchable)) {
            $document = $this->buildDocumentFromArray($this->searchable);

            return $document;
        } else {
            $document = $this->toArray();

            return $document;
        }
    }
99950
protected function getLines()
    {
        $ret = file($this->fileName);
        if ($ret === false) {
            throw new Exception('Unable to read file');
        }
        $lines = array();
        foreach ($ret as $line) {
            $lines[] = rtrim($line);
        }

        return $lines;
    }
878611
public function cgetAction()
    {
        $list = new CollectionRepresentation(
            $this->getDoctrine()->getRepository(self::$entityName)->findBy([], ['position' => 'ASC']),
            self::$entityKey
        );

        $view = $this->view($list, 200);

        return $this->handleView($view);
    }
324648
public function findAll()
    {
        $ext       = $this->formatter->getFileExtension();
        $files     = $this->getAllFiles();
        $documents = array();

        foreach ($files as $file) {
            $fp       = fopen($file, 'r');
            $contents = fread($fp, filesize($file));
            fclose($fp);

            $data = $this->formatter->decode($contents);

            if (null !== $data) {
                $doc = new $this->documentClass((array) $data);
                $doc->setId($this->getIdFromPath($file, $ext));

                $documents[] = $doc;
            }
        }

        return $documents;
    }
459717
public function getDocumentTypes()
  {
    $documentTypes = array();

    $this->DocumentType->byOrganization($this->AuthenticationManager->getCurrentUserOrganizationId())->each(function($DocumentType) use (&$documentTypes)
    {
      array_push($documentTypes, array('label'=> $DocumentType->name , 'value'=>$DocumentType->id));
    });

    return $documentTypes;
  }
831956
public function readByReference()
    {
        $service = $this->getService();

        $response      = $service->request('customers/lookup', 'GET', '', $this->getParams());
        $responseArray = $this->getResponseArray($response);

        // a 404 will be returned if not found, so make sure we have a 200
        if (!$this->isError() && '200' == $response->getStatusCode()) {
            $this->_data = $responseArray['customer'];
        } else {
            $this->_data = array();
        }

        return $this;
    }
683026
public function getAllDocuments()
    {
        $response = $this->getViewByGet('_all_docs');
        return $this->asDocs ? $this->toDocuments($response) : $response;
    }
177375
public function getNode()
    {
        if (!$this->node) {
            throw new \RuntimeException(sprintf(
                'Trying to retrieve node when no node has been set. An event ' .
                'listener should have set the node when persisting document "%s"',
                DocumentHelper::getDebugTitle($this->document)
            ));
        }

        return $this->node;
    }
475415
public function getDocumentByReference(array $ref, $useDocumentPool = true)
    {
        $documentArray = $this->getMongoCollection()->getDBRef($ref);
        if (null === $documentArray) {
            return null;
        }

        return $this->hydrate($documentArray, $useDocumentPool);
    }
889995
public function getReferences()
    {

        // build links
        $references = array();

        foreach( $this->getAttributes() as $column ) {

            // A relation has a reference if one of its attributes is referenced by another
            if( $column->isUnique() and ( $refs = $column->getIsReferencedBy() ) ) {

                foreach( $refs as $reference ) {

                    $name = sprintf(
                        "%s.%s",
                        $reference->getRelation()->getEntityName(),
                        $reference->name
                    );

                    $references[$name] = array(
                        $reference->getRelation()->getEntityName(),
                        $reference->name,
                        $reference->isUnique() ? 0 : 1
                    );

                }

            }

        }

        return $references;

    }
1236000
public function references($document)
    {
        if ($this->currentField) {
            $mapping = $this->class->getFieldMapping($this->currentField);
            $dbRef = $this->dm->createDBRef($document, $mapping);

            if (isset($mapping['simple']) && $mapping['simple']) {
                $this->query[$mapping['name']] = $dbRef;
            } else {
                $keys = array('ref' => true, 'id' => true, 'db' => true);

                if (isset($mapping['targetDocument'])) {
                    unset($keys['ref'], $keys['db']);
                }

                foreach ($keys as $key => $value) {
                    $this->query[$this->currentField . '.$' . $key] = $dbRef['$' . $key];
                }
            }
        } else {
            $dbRef = $this->dm->createDBRef($document);
            $this->query = $dbRef;
        }

        return $this;
    }
1118053
public function getCursor($collection = "")
		{
			if (empty($collection)) {
				throw new Exception("In order to retrieve documents from MongoDB you must provide a collection name.");
			}

			$documents = $this->db->{$collection}
			->find($this->wheres, $this->selects)
			->limit((int) $this->limit)
			->skip((int) $this->offset)
			->sort($this->sorts);

			$this->_clear();

			return $documents;
		}