public function getAllIdsForChildren(Tree $tree)
{
$treeIds = [];
/**
* @var $query ActiveQuery
*/
$childrens = $tree->getChildren()->with('children')->all();
if ($childrens) {
foreach ($childrens as $chidren) {
if ($chidren->children) {
$treeIds[$chidren->id] = $chidren->id;
$treeIds = array_merge($treeIds, $this->getAllIdsForChildren($chidren));
} else {
$treeIds[$chidren->id] = $chidren->id;
}
}
}
return $treeIds;
}