original_string: public function prepareFieldsFromTable()
      {
          foreach ($this->columns as $column) {
              $type = $column->getType()->getName();
  
              switch ($type) {
                  case 'integer':
                      $field = $this->generateIntFieldInput($column, 'integer');
                      break;
                  case 'smallint':
                      $field = $this->generateIntFieldInput($column, 'smallInteger');
                      break;
                  case 'bigint':
                      $field = $this->generateIntFieldInput($column, 'bigInteger');
                      break;
                  case 'boolean':
                      $name = title_case(str_replace('_', ' ', $column->getName()));
                      $field = $this->generateField($column, 'boolean', 'checkbox,1');
                      break;
                  case 'datetime':
                      $field = $this->generateField($column, 'datetime', 'date');
                      break;
                  case 'datetimetz':
                      $field = $this->generateField($column, 'dateTimeTz', 'date');
                      break;
                  case 'date':
                      $field = $this->generateField($column, 'date', 'date');
                      break;
                  case 'time':
                      $field = $this->generateField($column, 'time', 'text');
                      break;
                  case 'decimal':
                      $field = $this->generateNumberInput($column, 'decimal');
                      break;
                  case 'float':
                      $field = $this->generateNumberInput($column, 'float');
                      break;
                  case 'string':
                      $field = $this->generateField($column, 'string', 'text');
                      break;
                  case 'text':
                      $field = $this->generateField($column, 'text', 'textarea');
                      break;
                  default:
                      $field = $this->generateField($column, 'string', 'text');
                      break;
              }
  
              if (strtolower($field->name) == 'password') {
                  $field->htmlType = 'password';
              } elseif (strtolower($field->name) == 'email') {
                  $field->htmlType = 'email';
              } elseif (in_array($field->name, $this->timestamps)) {
                  $field->isSearchable = false;
                  $field->isFillable = false;
                  $field->inForm = false;
                  $field->inIndex = false;
              }
              $field->isNotNull = (bool) $column->getNotNull();
              $field->description = $column->getComment(); // get comments from table
  
              $this->fields[] = $field;
          }
      }
code: public function prepareFieldsFromTable()
      {
          foreach ($this->columns as $column) {
              $type = $column->getType()->getName();
  
              switch ($type) {
                  case 'integer':
                      $field = $this->generateIntFieldInput($column, 'integer');
                      break;
                  case 'smallint':
                      $field = $this->generateIntFieldInput($column, 'smallInteger');
                      break;
                  case 'bigint':
                      $field = $this->generateIntFieldInput($column, 'bigInteger');
                      break;
                  case 'boolean':
                      $name = title_case(str_replace('_', ' ', $column->getName()));
                      $field = $this->generateField($column, 'boolean', 'checkbox,1');
                      break;
                  case 'datetime':
                      $field = $this->generateField($column, 'datetime', 'date');
                      break;
                  case 'datetimetz':
                      $field = $this->generateField($column, 'dateTimeTz', 'date');
                      break;
                  case 'date':
                      $field = $this->generateField($column, 'date', 'date');
                      break;
                  case 'time':
                      $field = $this->generateField($column, 'time', 'text');
                      break;
                  case 'decimal':
                      $field = $this->generateNumberInput($column, 'decimal');
                      break;
                  case 'float':
                      $field = $this->generateNumberInput($column, 'float');
                      break;
                  case 'string':
                      $field = $this->generateField($column, 'string', 'text');
                      break;
                  case 'text':
                      $field = $this->generateField($column, 'text', 'textarea');
                      break;
                  default:
                      $field = $this->generateField($column, 'string', 'text');
                      break;
              }
  
              if (strtolower($field->name) == 'password') {
                  $field->htmlType = 'password';
              } elseif (strtolower($field->name) == 'email') {
                  $field->htmlType = 'email';
              } elseif (in_array($field->name, $this->timestamps)) {
                  $field->isSearchable = false;
                  $field->isFillable = false;
                  $field->inForm = false;
                  $field->inIndex = false;
              }
              $field->isNotNull = (bool) $column->getNotNull();
              $field->description = $column->getComment(); // get comments from table
  
              $this->fields[] = $field;
          }
      }
code_tokens: public function prepareFieldsFromTable ( ) { foreach ( $ this -> columns as $ column ) { $ type = $ column -> getType ( ) -> getName ( ) ; switch ( $ type ) { case 'integer' : $ field = $ this -> generateIntFieldInput ( $ column , 'integer' ) ; break ; case 'smallint' : $ field = $ this -> generateIntFieldInput ( $ column , 'smallInteger' ) ; break ; case 'bigint' : $ field = $ this -> generateIntFieldInput ( $ column , 'bigInteger' ) ; break ; case 'boolean' : $ name = title_case ( str_replace ( '_' , ' ' , $ column -> getName ( ) ) ) ; $ field = $ this -> generateField ( $ column , 'boolean' , 'checkbox,1' ) ; break ; case 'datetime' : $ field = $ this -> generateField ( $ column , 'datetime' , 'date' ) ; break ; case 'datetimetz' : $ field = $ this -> generateField ( $ column , 'dateTimeTz' , 'date' ) ; break ; case 'date' : $ field = $ this -> generateField ( $ column , 'date' , 'date' ) ; break ; case 'time' : $ field = $ this -> generateField ( $ column , 'time' , 'text' ) ; break ; case 'decimal' : $ field = $ this -> generateNumberInput ( $ column , 'decimal' ) ; break ; case 'float' : $ field = $ this -> generateNumberInput ( $ column , 'float' ) ; break ; case 'string' : $ field = $ this -> generateField ( $ column , 'string' , 'text' ) ; break ; case 'text' : $ field = $ this -> generateField ( $ column , 'text' , 'textarea' ) ; break ; default : $ field = $ this -> generateField ( $ column , 'string' , 'text' ) ; break ; } if ( strtolower ( $ field -> name ) == 'password' ) { $ field -> htmlType = 'password' ; } elseif ( strtolower ( $ field -> name ) == 'email' ) { $ field -> htmlType = 'email' ; } elseif ( in_array ( $ field -> name , $ this -> timestamps ) ) { $ field -> isSearchable = false ; $ field -> isFillable = false ; $ field -> inForm = false ; $ field -> inIndex = false ; } $ field -> isNotNull = ( bool ) $ column -> getNotNull ( ) ; $ field -> description = $ column -> getComment ( ) ; // get comments from table $ this -> fields [ ] = $ field ; } }
docstring: Prepares array of GeneratorField from table columns.
docstring_tokens: Prepares array of GeneratorField from table columns .