original_string: public function generateSearchRules()
      {
          if (($table = $this->getTableSchema()) === false) {
              return ["[['" . implode("', '", $this->getColumnNames()) . "'], 'safe']"];
          }
          $types = [];
          foreach ($table->columns as $column) {
              switch ($column->type) {
                  case Schema::TYPE_SMALLINT:
                  case Schema::TYPE_INTEGER:
                  case Schema::TYPE_BIGINT:
                      $types['integer'][] = $column->name;
                      break;
                  case Schema::TYPE_BOOLEAN:
                      $types['boolean'][] = $column->name;
                      break;
                  case Schema::TYPE_FLOAT:
                  case Schema::TYPE_DECIMAL:
                  case Schema::TYPE_MONEY:
                      //$types['number'][] = $column->name;
                      //break;
                  case Schema::TYPE_DATE:
                  case Schema::TYPE_TIME:
                  case Schema::TYPE_DATETIME:
                  case Schema::TYPE_TIMESTAMP:
                  default:
                      $types['safe'][] = $column->name;
                      break;
              }
          }   
  		
          $rules = [];
          foreach ($types as $type => $columns) {            
              $sf = "";
              if ($type == "safe")
              {
  				$tabs = $this->generateRelations();				
  				foreach ($tabs as $tab)
  				{
  					if ($tab) {			
  						$sf .= ($sf == ""?"/*, '":", '").$tab."Id'";
  					}					
  				}     					
  				$sf .= ($sf == ""?"":"*/");
  			}
  			$rules[] = "[['" . implode("', '", $columns) . "'".$sf."], '$type']";
          }
  
          return $rules;
      }
code: public function generateSearchRules()
      {
          if (($table = $this->getTableSchema()) === false) {
              return ["[['" . implode("', '", $this->getColumnNames()) . "'], 'safe']"];
          }
          $types = [];
          foreach ($table->columns as $column) {
              switch ($column->type) {
                  case Schema::TYPE_SMALLINT:
                  case Schema::TYPE_INTEGER:
                  case Schema::TYPE_BIGINT:
                      $types['integer'][] = $column->name;
                      break;
                  case Schema::TYPE_BOOLEAN:
                      $types['boolean'][] = $column->name;
                      break;
                  case Schema::TYPE_FLOAT:
                  case Schema::TYPE_DECIMAL:
                  case Schema::TYPE_MONEY:
                      //$types['number'][] = $column->name;
                      //break;
                  case Schema::TYPE_DATE:
                  case Schema::TYPE_TIME:
                  case Schema::TYPE_DATETIME:
                  case Schema::TYPE_TIMESTAMP:
                  default:
                      $types['safe'][] = $column->name;
                      break;
              }
          }   
  		
          $rules = [];
          foreach ($types as $type => $columns) {            
              $sf = "";
              if ($type == "safe")
              {
  				$tabs = $this->generateRelations();				
  				foreach ($tabs as $tab)
  				{
  					if ($tab) {			
  						$sf .= ($sf == ""?"/*, '":", '").$tab."Id'";
  					}					
  				}     					
  				$sf .= ($sf == ""?"":"*/");
  			}
  			$rules[] = "[['" . implode("', '", $columns) . "'".$sf."], '$type']";
          }
  
          return $rules;
      }
code_tokens: public function generateSearchRules ( ) { if ( ( $ table = $ this -> getTableSchema ( ) ) === false ) { return [ "[['" . implode ( "', '" , $ this -> getColumnNames ( ) ) . "'], 'safe']" ] ; } $ types = [ ] ; foreach ( $ table -> columns as $ column ) { switch ( $ column -> type ) { case Schema :: TYPE_SMALLINT : case Schema :: TYPE_INTEGER : case Schema :: TYPE_BIGINT : $ types [ 'integer' ] [ ] = $ column -> name ; break ; case Schema :: TYPE_BOOLEAN : $ types [ 'boolean' ] [ ] = $ column -> name ; break ; case Schema :: TYPE_FLOAT : case Schema :: TYPE_DECIMAL : case Schema :: TYPE_MONEY : //$types['number'][] = $column->name; //break; case Schema :: TYPE_DATE : case Schema :: TYPE_TIME : case Schema :: TYPE_DATETIME : case Schema :: TYPE_TIMESTAMP : default : $ types [ 'safe' ] [ ] = $ column -> name ; break ; } } $ rules = [ ] ; foreach ( $ types as $ type => $ columns ) { $ sf = "" ; if ( $ type == "safe" ) { $ tabs = $ this -> generateRelations ( ) ; foreach ( $ tabs as $ tab ) { if ( $ tab ) { $ sf .= ( $ sf == "" ? "/*, '" : ", '" ) . $ tab . "Id'" ; } } $ sf .= ( $ sf == "" ? "" : "*/" ) ; } $ rules [ ] = "[['" . implode ( "', '" , $ columns ) . "'" . $ sf . "], '$type']" ; } return $ rules ; }
docstring: Generates validation rules for the search model.
  @return array the generated validation rules
docstring_tokens: Generates validation rules for the search model .