Get IDs of children nodes.
@param mixed $headId
@param int|null Eg. 1 - children, 2 - grandchildren.
@param bool If enabled and $relativeDepth = 2 then select children and grandchildren.
@return array
348462
public function getChildren($headId, $relativeDepth = null, $summarize = false)
    {
        $head = $this->getNode($headId);
        $config = $this->config;
        $query = $this->table()
                ->select(null)
                ->select("$config[id] AS id")
                ->where("$config[lft] > ?", $head['lft'])
                ->where("$config[rgt] < ?", $head['rgt']);

        if (!is_null($relativeDepth)) {
            $absoluteDepth = $relativeDepth + $head['dpt'];
            if ($summarize) {
                $query->where("$config[dpt] <= ?", $absoluteDepth);
            } else {
                $query->where("$config[dpt] = ?", $absoluteDepth);
            }
        }

        $children = $query->fetchAll();

        return array_map(function($key) {
            return $key['id'];
        }, $children);
    }
1336491
public function getChildren($parent_id = null)
    {
        $parent_id = $parent_id ?? $this->id;
        $children = $this::find()
            ->where(['parent_id' => $parent_id, 'show' => true])
            ->orderBy(['position' => SORT_ASC])
            ->all();
        return $children;
    }
1101713
public function fetchTree($rootId=null, $depth=null)
    {
        $wrappers = $this->fetchTreeAsArray($rootId, $depth);

        return (!is_array($wrappers) || empty($wrappers)) ? null : $wrappers[0];
    }
956611
public function getCostCenterChildrenIds($id)
  {
    $ids = array();

    $this->CostCenter->byParent($id)->each(function($CostCenter) use (&$ids)
    {
      if($CostCenter->is_group)
      {
        $ids = array_merge($ids, $this->getCostCenterChildrenIds($CostCenter->id));
      }

      array_push($ids, $CostCenter->id);
    });

    return $ids;
  }
1101350
public function getPathNode($nodeId, $parameters = array(), $relative = false)
    {
        $node = $this->getNode($nodeId);

        return $this->getPath($node->getId(), $parameters, $relative);
    }
756572
public static function nodeChildren($parentId)
    {
        $parentId = intval($parentId);
        if (!static::$caching || empty(static::$_children[$parentId])) {
            $query = static::find()
                ->where(['parent_id' => $parentId])
                ->orderBy(static::$defaultOrderBy);
            $childList = $query
              //->asArray()
                ->all();
            if (static::$caching) {
                static::$_children[$parentId] = $childList;
            } else {
                return $childList;
            }
        }
        return static::$_children[$parentId];
    }
294720
public function get_child_ids() {
        $childids = array();
        foreach ($this->items as $child) {
           $childids[] = $child->id;
        }
        return $childids;
    }
169487
public function children($id = null)
    {
        $id = ($id == null) ? $this->root : $id;
        foreach ($this->data as $v) {
            if ($v[$this->fields[1]] == $id) {
                $result[$v[$this->fields[0]]] = $v;
            }
        }
        return isset($result) ? $result : null;
    }
986926
public function getChildren()
    {
        $nodes = [];
        try {
            $child = $this->firstChild();
            do {
                $nodes[] = $child;
                $child   = $this->nextChild($child->id());
            } while ( ! is_null($child));
        } catch (ChildNotFoundException $e) {
            // we are done looking for children
        }

        return $nodes;
    }
845924
public function getChild($id)
    {
        if (array_key_exists($id, $this->children_by_id)) {
            return $this->children_by_id[$id];
        } else {
            return null;
        }
    }
1068491
public function hasChildNodes($dsId = null)
    {
        if (!$dsId) {
            // use root as default
            $dsId = $this->rootDsId;
        }

        $childrenDsIds = $this->getChildrenDsIds($dsId);
        $hasChildren = count($childrenDsIds) > 0;

        return $hasChildren;
    }
376156
def get_id_head(self):
        '''
        
        '''
        id_head = None
        for target_node in self:
            if target_node.is_head():
                id_head = target_node.get_id()
                break
        return id_head
1362630
private function _getAncectors($id)
    {
        $nodes = [];
        foreach ($this->_tree as $key => $value) {
            if ($value['id'] == $id) {
                $nodes[] = $value;
                if ($value[$this->_parentSign] != 0) {
                    $nodes = array_merge($nodes, $this->_getAncectors($value[$this->_parentSign]));
                }
            }
        }
        return $nodes;
    }
486296
def _get_id2children(id2children, item_id, item_obj):
    """"""
    if item_id in id2children:
        return id2children[item_id]
    child_ids = set()
    for child_obj in item_obj.children:
        child_id = child_obj.item_id
        child_ids.add(child_id)
        child_ids |= _get_id2children(id2children, child_id, child_obj)
    id2children[item_id] = child_ids
    return child_ids
574774
private function getChildren($parentID)
    {
        $tmp = [];
        $count = 0;
        foreach($this->existingMenuLinks as $key => $menuLink){
            if ($menuLink['parent'] == $parentID) {
                $tmp[$count] = $menuLink;
                $count++;
            }
        }
        return $tmp;
    }
575271
public function get_items_peers($itemid) {
        $itemref = $this->find_item($itemid);
        $peerids = $itemref->parentlist->get_child_ids();
        return $peerids;
    }
980971
private function getChildsForLinkedLayer($layerId, $parentLayer)
    {
        $childLayers = C4gMapsModel::findPublishedByPid($layerId);
        $arrLayerData['childs'] = [];
        
        foreach ($childLayers as $childLayer) {
            if ($childLayer->location_type !== "none") {
                // we reached the "bottom" of the tree leaf
                $childData = $this->parseLayer($childLayer);
                $childData['pid'] = $parentLayer->id;
                $arrLayerData['childs'][] = $childData;
                $arrLayerData['hide'] = $parentLayer->data_hidelayer;
            } else {
                $currentChildLayer = $this->parseLayer($childLayer);
                // set correct pid for the contentless element
                $currentChildLayer['pid'] = $parentLayer->id;
                // $childLayer is the acutal existing layer.
                $arrChildData = $this->getChildsForLinkedLayer($childLayer->id, (object) $currentChildLayer);
                $currentChildLayer['childs'] = $arrChildData['childs'];
                $currentChildLayer['content'] = [];
                $currentChildLayer['hasChilds'] = count($currentChildLayer['childs']) > 0;
                $currentChildLayer['childsCount'] = count($currentChildLayer['childs']);
                $arrLayerData['childs'][] = $currentChildLayer;
            }
            
            $arrLayerData['content'] = [];
            $arrLayerData['hasChilds'] = count($arrLayerData['childs']) > 0;
            $arrLayerData['childsCount'] = count($arrLayerData['childs']);
        }
        
        return $arrLayerData;
    }