Finds all child nodes including a key

@param string $parentId
@param string $key
@return array
178523
private function findChildNodeWithKey($parentId, $key)
	{
        $result = array();
        $relations = $this->getRelations();

        if (isset($relations[RelationBuilder::TREE_PARAM_PARENTS][$parentId])) {
            foreach ($relations[RelationBuilder::TREE_PARAM_PARENTS][$parentId] as $id) {
                // Current found node
                $node = $relations[RelationBuilder::TREE_PARAM_ITEMS][$id][$key];

                $result = array_merge($result, $this->findChildNodeWithKey($id, $key));
                $result[] = $node;
            }
        }

        return $result;
    }
695699
public static function existsInParentsChain($nodeId, $parentId)
    {
        $nextParentId = $parentId;
        $exists = false;
        while (true) {
            if ($nodeId == $nextParentId) {
                $exists = true;
                break;
            }

            $nextParentNode = static::node($nextParentId);
            if (empty($nextParentNode)) break;

            $nextParentId = $nextParentNode['parent_id'];
         }

         return $exists;
    }
920880
public function find($key)
    {
        $path = $this->finder->find($name);

        if ($path && !in_array($path, $this->paths)) {
            array_unshift($this->paths, $path);
        }

        return parent::find($name);
    }
456887
private function getAllChildRoleIds($parentIds)
    {
        $allChildIds = [];

        while (count($parentIds) > 0) {
            $parentIds = $this->getChildIds($parentIds);
            $allChildIds = ArrayHelper::merge($allChildIds, $parentIds);
        };

        return $allChildIds;
    }
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;
    }
1312420
final protected function parseData(array $data, $parentId = 0)
    {
        $result = array();

        foreach ($data as $subArray) {
            $nested = array();

            if (isset($subArray[$this->childrenKey])) {
                // Recursive call
                $nested = $this->parseData($subArray[$this->childrenKey], $subArray[RelationBuilder::TREE_PARAM_ID]);
            }

            $result[] = array(
                RelationBuilder::TREE_PARAM_ID => $subArray[RelationBuilder::TREE_PARAM_ID], 
                RelationBuilder::TREE_PARAM_PARENT_ID => $parentId
            );

            $result = array_merge($result, $nested);
        }

        return $result;
    }
1018806
protected function normalizeData(array $data, $parentId = null) {
        $result = [];
        foreach ($data as $element) {
            if (ArrayHelper::getValue($element, $this->parentColumnName) === $parentId) {
                $result[] = $element;
                $children = $this->normalizeData($data, ArrayHelper::getValue($element, $this->keyColumnName));
                if ($children) {
                    $result = array_merge($result, $children);
                }
            }
        }
        return $result;
    }
200478
public function findAll($parentId, array $query = [])
    {
        $resource = $this->createPartialResourceUrlForList($parentId);
        $data = $this->client->get($resource, $query);

        return $this->createMany(reset($data));
    }
1261612
public function filterByPrimaryKey($key)
    {
        $this->addUsingAlias(StructureNodeParentTableMap::COL_STRUCTURE_NODE_ID, $key[0], Criteria::EQUAL);
        $this->addUsingAlias(StructureNodeParentTableMap::COL_PARENT_ID, $key[1], Criteria::EQUAL);

        return $this;
    }
1260097
public function parseKey($key)
	{
		$segments = parent::parseKey($key);

		if (is_null($segments[0])) $segments[0] = '*';

		return $segments;
	}
1262277
public function getParentNodes($dsId)
    {
        $parents = [];

        $node = $this->getNode($dsId);
        while ($node) {
            // get parent
            $node = $this->getParentNode($node->getDsId());

            // add id
            if ($node) {
                $parents[] = $node;
            }
        }

        return $parents;
    }
1159382
private function getParentNode($parent, $webspaceKey, $languageCode)
    {
        if (null != $parent) {
            return $this->getMapper()->load($parent, $webspaceKey, $languageCode);
        } else {
            return $this->getMapper()->loadStartPage($webspaceKey, $languageCode);
        }
    }
523915
private function buildTree(?string $parentId, array $categories): array
    {
        $mapped = [];
        foreach ($categories as $key => $category) {
            if ($category->getParentId() !== $parentId) {
                continue;
            }

            unset($categories[$key]);

            $item = clone $this->treeItem;
            $item->setCategory($category);
            $item->setChildren(
                $this->buildTree($category->getId(), $categories)
            );

            $mapped[$category->getId()] = $item;
        }

        return $mapped;
    }
267389
public function findChildrenTreeByParentId($parent_id)
    {
        $qb = $this->createQueryBuilder();

        $qb = $this->alterQueryBuilderWithParentRoot($qb, $parent_id);

        $qb->orderBy($qb->getRootAliases()[0] . '.lft', 'ASC');

        return $this->getResultFromQueryBuilder($qb);
    }
864587
public function getRecursivePageChildIds($parentId)
    {
        $select = new Kwf_Model_Select();
        $ret = $this->_getChildPageIds($parentId);
        foreach ($ret as $i) {
            $ret = array_merge($ret, $this->getRecursivePageChildIds($i));
        }
        return $ret;
    }
752641
public static function get($parent, $key)
    {
        is_eloquent_object($parent, true);
        // if you think those 2 issets can be simplified into just one
        // you've probably never dealt with \SplObjectStorage
        $cache = static::getCache();
        if (
            isset($cache[$parent])
            && isset($cache[$parent][$key])
        ) {
            return $cache[$parent][$key];
        }
    }
226187
public function find($parentId, $id)
    {
        $resource = $this->createPartialResourceUrlForView($parentId, $id);
        $data = $this->client->get($resource);

        return $this->fromArray(reset($data));
    }