yii\mongodb\rbac\MongoDbManager::getChildrenList PHP Method

getChildrenList() protected method

Returns the children for every parent.
protected getChildrenList ( ) : array
return array the children list. Each array key is a parent item name, and the corresponding array value is a list of child item names.
    protected function getChildrenList()
    {
        $query = (new Query())->select(['name', 'parents'])->from($this->itemCollection);
        $children = [];
        foreach ($query->all($this->db) as $row) {
            if (!empty($row['parents'])) {
                foreach ($row['parents'] as $name) {
                    $children[$name][] = $row['name'];
                }
            }
        }
        return $children;
    }