public function get_all(string $id_option = null, bool $with_config = true): ?array
  {
    if ( $id_option = $this->_get_id_option($id_option) ){

      $fields = $this->fields;
      if ( !$with_config ){
        unset($fields['cfg']);
      }
      $table = $this->db->tsn($this->class_table, true);
      $cols = implode(', ', array_map(function($a) use($table){
        return $a === $this->fields['id'] ? "$table.$a" : "IFNULL(aliases.$a, $table.$a) AS $a";
      }, $fields));
      $id_opt = $this->db->cfn($this->fields['id_option'], $this->class_table, true);
      $id_user = $this->db->cfn($this->fields['id_user'], $this->class_table, true);
      $id_group = $this->db->cfn($this->fields['id_group'], $this->class_table, true);
      $num = $this->db->cfn($this->fields['num'], $this->class_table, true);
      $text = $this->db->cfn($this->fields['text'], $this->class_table, true);
      $id_alias = $this->db->cfn($this->fields['id_alias'], $this->class_table, true);
      $public = $this->db->cfn($this->fields['public'], $this->class_table, true);
      $sql = <<< MYSQL
SELECT $cols
FROM $table
  LEFT JOIN $table as aliases
    ON aliases.id = $id_alias
WHERE $id_opt = UNHEX(?)
AND ($id_user = UNHEX(?)
OR $id_group = UNHEX(?)
OR $public = 1)
ORDER BY IFNULL($num, $text)
MYSQL;
      if ( $rows =  $this->db->get_rows($sql, $id_option, $this->id_user, $this->id_group) ){
        return $with_config ? array_map(function($a){
          $cfg = $a['cfg'];
          unset($a['cfg']);
          if ( ($cfg = json_decode($cfg, true)) ){
            $a = bbn\x::merge_arrays($cfg, $a);
          }
          return $a;
        }, $rows) : $rows;
      }
      return [];
    }
    return null;
  }