src/bbn/user/preferences.php
public function get_full_bits(string $id_usr_opt, string $id_parent = null, bool $with_config = true): array
  {
    if ( \bbn\str::is_uid($id_usr_opt) ){
      $c = $this->class_cfg['arch']['user_options_bits'];
      $t = $this;
      return array_map(function($b) use($t, $c, $id_usr_opt, $with_config){
        if ( !empty($with_config) ){
          $b = $t->explode_bit_cfg($b);
        }
        $b['items'] = $t->get_full_bits($id_usr_opt, $b[$c['id']], $with_config);
        return $b;
      }, $this->db->rselect_all([
        'table' => $this->class_cfg['tables']['user_options_bits'],
        'fields' => [],
        'where' => [
          'conditions' => [[
            'field' => $c['id_user_option'],
            'value' => $id_usr_opt
          ], [
            'field' => $c['id_parent'],
            empty($id_parent) ? 'operator' : 'value' => $id_parent ?: 'isnull'
          ]]
        ],
        'order' => [$c['num'] => 'ASC']
      ]));
    }
    return [];
  }
public function get_full_bits(string $id_usr_opt, string $id_parent = null, bool $with_config = true): array
  {
    if ( \bbn\str::is_uid($id_usr_opt) ){
      $c = $this->class_cfg['arch']['user_options_bits'];
      $t = $this;
      return array_map(function($b) use($t, $c, $id_usr_opt, $with_config){
        if ( !empty($with_config) ){
          $b = $t->explode_bit_cfg($b);
        }
        $b['items'] = $t->get_full_bits($id_usr_opt, $b[$c['id']], $with_config);
        return $b;
      }, $this->db->rselect_all([
        'table' => $this->class_cfg['tables']['user_options_bits'],
        'fields' => [],
        'where' => [
          'conditions' => [[
            'field' => $c['id_user_option'],
            'value' => $id_usr_opt
          ], [
            'field' => $c['id_parent'],
            empty($id_parent) ? 'operator' : 'value' => $id_parent ?: 'isnull'
          ]]
        ],
        'order' => [$c['num'] => 'ASC']
      ]));
    }
    return [];
  }
public function get_full_bits ( string $ id_usr_opt , string $ id_parent = null , bool $ with_config = true ) : array { if ( \ bbn \ str :: is_uid ( $ id_usr_opt ) ) { $ c = $ this -> class_cfg [ 'arch' ] [ 'user_options_bits' ] ; $ t = $ this ; return array_map ( function ( $ b ) use ( $ t , $ c , $ id_usr_opt , $ with_config ) { if ( ! empty ( $ with_config ) ) { $ b = $ t -> explode_bit_cfg ( $ b ) ; } $ b [ 'items' ] = $ t -> get_full_bits ( $ id_usr_opt , $ b [ $ c [ 'id' ] ] , $ with_config ) ; return $ b ; } , $ this -> db -> rselect_all ( [ 'table' => $ this -> class_cfg [ 'tables' ] [ 'user_options_bits' ] , 'fields' => [ ] , 'where' => [ 'conditions' => [ [ 'field' => $ c [ 'id_user_option' ] , 'value' => $ id_usr_opt ] , [ 'field' => $ c [ 'id_parent' ] , empty ( $ id_parent ) ? 'operator' : 'value' => $ id_parent ? : 'isnull' ] ] ] , 'order' => [ $ c [ 'num' ] => 'ASC' ] ] ) ) ; } return [ ] ; }
Returns the hierarchical bits list of a preference

@param string $id_usr_opt The preference's ID
@param string $id_parent The parent's ID of a bit. Default: null
@param bool $with_config Set it to false if you don't want the preference's cfg field values on the results.
@return array
Returns the hierarchical bits list of a preference