Author: Tamás Millián (tamas.millian@gmail.com)
Inheritance: extends Doctrine\Common\Proxy\AbstractProxyFactory
 /**
  * Returns a reference to an entity. It will be lazily and transparently
  * loaded if anything other than the identifier is touched.
  *
  * @param $rid
  *
  * @return Proxy
  */
 public function getReference($rid)
 {
     $oclass = $this->clusterMap->identifyClass($rid);
     $md = $this->metadataFactory->getMetadataForOClass($oclass);
     if ($document = $this->uow->tryGetById($rid, $md)) {
         return $document;
     }
     $document = $this->proxyFactory->getProxy($md->name, [$md->getRidPropertyName() => $rid]);
     $this->uow->registerManaged($document, $rid, []);
     return $document;
 }