original_string: private function generateOptionsRecursively($pid = 0, $prefix = '')
      {
          $options = [];
          $records = $this->db->fetchAll('SELECT * FROM tl_news_category WHERE pid=? ORDER BY sorting', [$pid]);
  
          foreach ($records as $record) {
              $options[$record['id']] = $prefix . $record['title'];
  
              foreach ($this->generateOptionsRecursively($record['id'], $record['title'] . ' / ') as $k => $v) {
                  $options[$k] = $v;
              }
          }
  
          return $options;
      }
code: private function generateOptionsRecursively($pid = 0, $prefix = '')
      {
          $options = [];
          $records = $this->db->fetchAll('SELECT * FROM tl_news_category WHERE pid=? ORDER BY sorting', [$pid]);
  
          foreach ($records as $record) {
              $options[$record['id']] = $prefix . $record['title'];
  
              foreach ($this->generateOptionsRecursively($record['id'], $record['title'] . ' / ') as $k => $v) {
                  $options[$k] = $v;
              }
          }
  
          return $options;
      }
code_tokens: private function generateOptionsRecursively ( $ pid = 0 , $ prefix = '' ) { $ options = [ ] ; $ records = $ this -> db -> fetchAll ( 'SELECT * FROM tl_news_category WHERE pid=? ORDER BY sorting' , [ $ pid ] ) ; foreach ( $ records as $ record ) { $ options [ $ record [ 'id' ] ] = $ prefix . $ record [ 'title' ] ; foreach ( $ this -> generateOptionsRecursively ( $ record [ 'id' ] , $ record [ 'title' ] . ' / ' ) as $ k => $ v ) { $ options [ $ k ] = $ v ; } } return $ options ; }
docstring: Generate the options recursively
  
  @param int    $pid
  @param string $prefix
  
  @return array
docstring_tokens: Generate the options recursively