src/Sulu/Component/DocumentManager/DocumentRegistry.php
private function validateDocumentRegistration($document, $locale, NodeInterface $node, $oid, $uuid)
    {
        if (null === $uuid) {
            throw new DocumentManagerException(sprintf(
                'Node "%s" of type "%s" has no UUID. Only referencable nodes can be registered by the document manager',
                $node->getPath(), $node->getPrimaryNodeType()->getName()
            ));
        }

        $documentNodeKey = $this->getNodeLocaleKey($node->getIdentifier(), $locale);
        if (array_key_exists($uuid, $this->nodeMap) && array_key_exists($documentNodeKey, $this->nodeDocumentMap)) {
            $registeredDocument = $this->nodeDocumentMap[$documentNodeKey];

            throw new \RuntimeException(sprintf(
                'Document "%s" (%s) is already registered for node "%s" (%s) when trying to register document "%s" (%s)',
                spl_object_hash($registeredDocument),
                get_class($registeredDocument),
                $uuid,
                $node->getPath(),
                $oid,
                get_class($document)
            ));
        }
    }
private function validateDocumentRegistration($document, $locale, NodeInterface $node, $oid, $uuid)
    {
        if (null === $uuid) {
            throw new DocumentManagerException(sprintf(
                'Node "%s" of type "%s" has no UUID. Only referencable nodes can be registered by the document manager',
                $node->getPath(), $node->getPrimaryNodeType()->getName()
            ));
        }

        $documentNodeKey = $this->getNodeLocaleKey($node->getIdentifier(), $locale);
        if (array_key_exists($uuid, $this->nodeMap) && array_key_exists($documentNodeKey, $this->nodeDocumentMap)) {
            $registeredDocument = $this->nodeDocumentMap[$documentNodeKey];

            throw new \RuntimeException(sprintf(
                'Document "%s" (%s) is already registered for node "%s" (%s) when trying to register document "%s" (%s)',
                spl_object_hash($registeredDocument),
                get_class($registeredDocument),
                $uuid,
                $node->getPath(),
                $oid,
                get_class($document)
            ));
        }
    }
private function validateDocumentRegistration ( $ document , $ locale , NodeInterface $ node , $ oid , $ uuid ) { if ( null === $ uuid ) { throw new DocumentManagerException ( sprintf ( 'Node "%s" of type "%s" has no UUID. Only referencable nodes can be registered by the document manager' , $ node -> getPath ( ) , $ node -> getPrimaryNodeType ( ) -> getName ( ) ) ) ; } $ documentNodeKey = $ this -> getNodeLocaleKey ( $ node -> getIdentifier ( ) , $ locale ) ; if ( array_key_exists ( $ uuid , $ this -> nodeMap ) && array_key_exists ( $ documentNodeKey , $ this -> nodeDocumentMap ) ) { $ registeredDocument = $ this -> nodeDocumentMap [ $ documentNodeKey ] ; throw new \ RuntimeException ( sprintf ( 'Document "%s" (%s) is already registered for node "%s" (%s) when trying to register document "%s" (%s)' , spl_object_hash ( $ registeredDocument ) , get_class ( $ registeredDocument ) , $ uuid , $ node -> getPath ( ) , $ oid , get_class ( $ document ) ) ) ; } }
Ensure that the document is not already registered and that the node
has a UUID.

@param object $document
@param NodeInterface $node
@param string $oid
@param string $uuid

@throws DocumentManagerException
Ensure that the document is not already registered and that the node has a UUID .