--
$depth;
} foreach ($children as &
$child) { $category =
$child['category'
];
$category['childrenCount'
] =
$child['childrenCount'
];
$category['articleCount'
] =
$child['articleCount'
];
$categories[] =
$category;
// Check if no depth passed or the current depth is lower than the passed depth
if ($depth === null ||
$depth > 0
) { $subCategories =
$this->
getActiveChildrenList($child['category'
]['id'
],
$customerGroupId,
$depth);
$categories =
array_merge($categories,
$subCategories);
} } return $categories;
} /**
* @param int $id
*
* @return int
*/