original_string: public function getQueryReference($key = '', $foreign = '', $foreignLabel = '', $foreignKey = '', &$i)
      {
          $model      = Norm::factory($foreign);
          $refSchemes = $model->schema();
          $foreignKey = $foreignKey ?: 'id';
  
          if ($foreignKey == '$id') {
              $foreignKey = 'id';
          }
  
          $query = $key . ' IN (SELECT '.$foreignKey.' FROM '.strtolower($foreign).' WHERE '.$foreignLabel.' LIKE :f'.$i.') ';
          $i++;
  
          return $query;
      }
code: public function getQueryReference($key = '', $foreign = '', $foreignLabel = '', $foreignKey = '', &$i)
      {
          $model      = Norm::factory($foreign);
          $refSchemes = $model->schema();
          $foreignKey = $foreignKey ?: 'id';
  
          if ($foreignKey == '$id') {
              $foreignKey = 'id';
          }
  
          $query = $key . ' IN (SELECT '.$foreignKey.' FROM '.strtolower($foreign).' WHERE '.$foreignLabel.' LIKE :f'.$i.') ';
          $i++;
  
          return $query;
      }
code_tokens: public function getQueryReference ( $ key = '' , $ foreign = '' , $ foreignLabel = '' , $ foreignKey = '' , & $ i ) { $ model = Norm :: factory ( $ foreign ) ; $ refSchemes = $ model -> schema ( ) ; $ foreignKey = $ foreignKey ? : 'id' ; if ( $ foreignKey == '$id' ) { $ foreignKey = 'id' ; } $ query = $ key . ' IN (SELECT ' . $ foreignKey . ' FROM ' . strtolower ( $ foreign ) . ' WHERE ' . $ foreignLabel . ' LIKE :f' . $ i . ') ' ; $ i ++ ; return $ query ; }
docstring: Find reference of a foreign key.
  
  @param string $key
  @param string $foreign
  @param string $foreignLabel
  @param string $foreignKey
  @param int &$i
  
  @return string
docstring_tokens: Find reference of a foreign key .