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

determineDocumentId() 공개 메소드

Try to determine the document id first by looking into the document, but if not mapped, look into the document id cache.
public determineDocumentId ( object $document, ClassMetadata $metadata = null ) : string | null
$document object
$metadata Doctrine\ODM\PHPCR\Mapping\ClassMetadata
리턴 string | null the current or stored id, or null if nothing can be found.
    public function determineDocumentId($document, ClassMetadata $metadata = null)
    {
        if (!$metadata) {
            $metadata = $this->dm->getClassMetadata(get_class($document));
        }
        if ($metadata->identifier) {
            $id = $metadata->getIdentifierValue($document);
            if ($id) {
                return $id;
            }
        }
        return $this->getDocumentId($document, false);
    }
UnitOfWork