public function getIdentifierValue($document)
    {
        if (!$this->identifier) {
            throw new PHPCRException(sprintf(
                'Class %s has no identifier field mapped. Please use $documentManager->getUnitOfWork()->getDocumentId($document) to get the id of arbitrary documents.',
                $this->name
            ));
        }

        return (string) $this->getFieldValue($document, $this->identifier);
    }