__getDocumentData() sets categories

This commit is contained in:
Uwe Steinmann 2023-12-13 08:23:19 +01:00
parent 2a2035cccf
commit cab5f5bb2e

View File

@ -44,13 +44,19 @@ class RestapiController { /* {{{ */
} /* }}} */ } /* }}} */
protected function __getDocumentData($document) { /* {{{ */ protected function __getDocumentData($document) { /* {{{ */
$cats = $document->getCategories();
$tmp = [];
foreach($cats as $cat) {
$tmp[] = $this->__getCategoryData($cat);
}
$data = array( $data = array(
'type'=>'document', 'type'=>'document',
'id'=>(int)$document->getId(), 'id'=>(int)$document->getId(),
'date'=>date('Y-m-d H:i:s', $document->getDate()), 'date'=>date('Y-m-d H:i:s', $document->getDate()),
'name'=>$document->getName(), 'name'=>$document->getName(),
'comment'=>$document->getComment(), 'comment'=>$document->getComment(),
'keywords'=>$document->getKeywords() 'keywords'=>$document->getKeywords(),
'categories'=>$tmp
); );
return $data; return $data;
} /* }}} */ } /* }}} */