/** * @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())); }
/** * 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); }