foreach rubrics as rubric children array foreach rubric- getChildren a

1
2
3
4
5
6
7
8
foreach ($rubrics as $rubric) {
$children = array();
foreach ($rubric->getChildren() as $childRubric) {
$children[] = array('id' => $childRubric->idtopcat, 'name' => $childRubric->catname);
}
$row = array('id' => $rubric->idtopcat, 'name' => $rubric->catname, 'children' => $children);
$treeData[] = $row;
}