예제 #1
0
 /**
  * Adds a flag to indicate if the document has children.
  *
  * @param ObjectEvent $event
  */
 public function onPostSerialize(ObjectEvent $event)
 {
     $document = $event->getObject();
     if (!$document instanceof ChildrenBehavior || !$this->documentRegistry->hasDocument($document)) {
         return;
     }
     $visitor = $event->getVisitor();
     $visitor->addData('hasSub', $this->documentInspector->hasChildren($document));
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function getHasChildren()
 {
     return $this->inspector->hasChildren($this->getDocument());
 }