registerDocument() публичный Метод

public registerDocument ( object $document, string $id ) : string
$document object
$id string The document id to look for.
Результат string generated object hash
Пример #1
0
 /**
  * @author Rob Graham
  * 
  * Test the registering of a version of a document, state should be set to STATE_FROZEN
  */
 public function testRegisterDocumentForVersion()
 {
     // create a node of type frozenNode (which is a version)
     $node = $this->createNode('/version/doc', 'foo', 'nt:frozenNode');
     $document = $this->uow->getOrCreateDocument($this->type, $node);
     $this->uow->registerDocument($document, '/version/doc');
     $this->assertEquals(UnitOfWork::STATE_FROZEN, $this->uow->getDocumentState($document), 'A version of a document is frozen as expected');
 }
Пример #2
0
 /**
  * Gets a reference to the document identified by the given type and identifier
  * 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 string $documentName
  * @param string|object $id
  * @return mixed|object The document reference.
  */
 public function getReference($documentName, $id)
 {
     $class = $this->metadataFactory->getMetadataFor($documentName);
     // Check identity map first, if its already in there just return it.
     $document = $this->unitOfWork->getDocumentById($id);
     if ($document) {
         return $document;
     }
     $document = $this->proxyFactory->getProxy($class->name, $id);
     $this->unitOfWork->registerDocument($document, $id);
     return $document;
 }