/**
  * Return the parent document for the given document.
  *
  * @param object $document
  *
  * @return object|null
  */
 public function getParent($document)
 {
     $parentNode = $this->getNode($document)->getParent();
     if (!$parentNode) {
         return;
     }
     return $this->proxyFactory->createProxyForNode($document, $parentNode);
 }
 private function mapParent($document, NodeInterface $node)
 {
     // TODO: performance warning: We are eagerly fetching the parent node
     $targetNode = $node->getParent();
     // Do not map non-referenceable parent nodes
     if (!$targetNode->hasProperty('jcr:uuid')) {
         return;
     }
     $document->setParent($this->proxyFactory->createProxyForNode($document, $targetNode));
 }