protected static function indexByParent($rows)
    {
        $parents = [];

        foreach ($rows as $row) {
            $parents[(int) $row['parent_id']][(int) $row['child_id']] = (int) $row['child_id'];
        }

        return $parents;
    }
protected static function indexByParent($rows)
    {
        $parents = [];

        foreach ($rows as $row) {
            $parents[(int) $row['parent_id']][(int) $row['child_id']] = (int) $row['child_id'];
        }

        return $parents;
    }
protected static function indexByParent ( $ rows ) { $ parents = [ ] ; foreach ( $ rows as $ row ) { $ parents [ ( int ) $ row [ 'parent_id' ] ] [ ( int ) $ row [ 'child_id' ] ] = ( int ) $ row [ 'child_id' ] ; } return $ parents ; }
Index rows by parent id
@param array $rows
@return array
Index rows by parent id