Doctrine\ODM\PHPCR\UnitOfWork::registerDocument PHP 메소드

registerDocument() 공개 메소드

public registerDocument ( object $document, string $id ) : string
$document object
$id string The document id to look for.
리턴 string generated object hash
    public function registerDocument($document, $id)
    {
        $oid = spl_object_hash($document);
        $this->documentIds[$oid] = $id;
        $this->identityMap[$id] = $document;
        // frozen nodes need another state so they are managed but not included for updates
        $frozen = $this->session->nodeExists($id) && $this->session->getNode($id)->isNodeType('nt:frozenNode');
        $this->setDocumentState($oid, $frozen ? self::STATE_FROZEN : self::STATE_MANAGED);
        return $oid;
    }

Usage Example

예제 #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');
 }
All Usage Examples Of Doctrine\ODM\PHPCR\UnitOfWork::registerDocument
UnitOfWork