/**
  * @param HydrateEvent $event
  */
 public function handleHydrate(HydrateEvent $event)
 {
     $document = $event->getDocument();
     if (!$document instanceof ChildrenBehavior) {
         return;
     }
     $accessor = $event->getAccessor();
     $accessor->set('children', $this->proxyFactory->createChildrenCollection($document, $event->getOptions()));
 }
 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));
 }
 /**
  * Returns lazy-loading children collection for given document.
  *
  * @param object $document
  * @param array $options
  *
  * @return Collection\ChildrenCollection
  */
 public function getChildren($document, array $options = [])
 {
     return $this->proxyFactory->createChildrenCollection($document, $options);
 }