Shopware\DataGenerator\Resources\Articles::getCategoryPath PHP Method

getCategoryPath() private method

private getCategoryPath ( $id, $categories ) : array
$id
$categories
return array
    private function getCategoryPath($id, $categories)
    {
        if (!$id) {
            return [];
        }
        if (!isset($categories[$id])) {
            return [];
        }
        if ($id == 1) {
            return [];
        }
        $category = $categories[$id];
        $result[] = $id;
        if ($category['parent']) {
            $parent = $this->getCategoryPath($category['parent'], $categories);
            $result = array_merge($result, $parent);
        }
        return $result;
    }