protected function getTransfredFields(array $columns)
    {
        $collection = [];

        foreach ($columns as $column) {
            // While constructing the array for each field
            // there is no need to set translations for options
            // or even labels. This step is handled using the FieldTransformer
            $properties['name'] = $column->COLUMN_NAME;
            $properties['is-nullable'] = ($column->IS_NULLABLE == 'YES');
            $properties['data-value'] = $column->COLUMN_DEFAULT;
            $properties['data-type'] = $this->getDataType($column->DATA_TYPE, $column->COLUMN_TYPE);
            $properties['data-type-params'] = $this->getPrecision($column->CHARACTER_MAXIMUM_LENGTH, $column->DATA_TYPE, $column->COLUMN_TYPE);
            $properties['is-primary'] = in_array($column->COLUMN_KEY, ['PRIMARY KEY', 'PRI']);
            $properties['is-index'] = ($column->COLUMN_KEY == 'MUL');
            $properties['is-unique'] = ($column->COLUMN_KEY == 'UNI');
            $properties['is-auto-increment'] = ($column->EXTRA == 'AUTO_INCREMENT');
            $properties['comment'] = $column->COLUMN_COMMENT ?: null;
            $properties['options'] = $this->getHtmlOptions($column->DATA_TYPE, $column->COLUMN_TYPE);
            $properties['is-unsigned'] = (strpos($column->COLUMN_TYPE, 'unsigned') !== false);

            $constraint = $this->getForeignConstraint($column->COLUMN_NAME);

            $properties['foreign-constraint'] = !is_null($constraint) ? $constraint->toArray() : null;

            if (intval($column->CHARACTER_MAXIMUM_LENGTH) > 255
                || in_array($column->DATA_TYPE, $this->largeDataTypes)) {
                $properties['is-on-index'] = false;
            }

            $collection[] = $properties;
        }

        $localeGroup = Helpers::makeLocaleGroup($this->tableName);

        $fields = FieldTransformer::fromArray($collection, $localeGroup, $this->languages);

        // At this point we constructed the fields collection with the default html-type
        // We need to set the html-type using the config::getEloquentToHtmlMap() setting
        $this->setHtmlType($fields);

        return $fields;
    }
protected function getTransfredFields(array $columns)
    {
        $collection = [];

        foreach ($columns as $column) {
            // While constructing the array for each field
            // there is no need to set translations for options
            // or even labels. This step is handled using the FieldTransformer
            $properties['name'] = $column->COLUMN_NAME;
            $properties['is-nullable'] = ($column->IS_NULLABLE == 'YES');
            $properties['data-value'] = $column->COLUMN_DEFAULT;
            $properties['data-type'] = $this->getDataType($column->DATA_TYPE, $column->COLUMN_TYPE);
            $properties['data-type-params'] = $this->getPrecision($column->CHARACTER_MAXIMUM_LENGTH, $column->DATA_TYPE, $column->COLUMN_TYPE);
            $properties['is-primary'] = in_array($column->COLUMN_KEY, ['PRIMARY KEY', 'PRI']);
            $properties['is-index'] = ($column->COLUMN_KEY == 'MUL');
            $properties['is-unique'] = ($column->COLUMN_KEY == 'UNI');
            $properties['is-auto-increment'] = ($column->EXTRA == 'AUTO_INCREMENT');
            $properties['comment'] = $column->COLUMN_COMMENT ?: null;
            $properties['options'] = $this->getHtmlOptions($column->DATA_TYPE, $column->COLUMN_TYPE);
            $properties['is-unsigned'] = (strpos($column->COLUMN_TYPE, 'unsigned') !== false);

            $constraint = $this->getForeignConstraint($column->COLUMN_NAME);

            $properties['foreign-constraint'] = !is_null($constraint) ? $constraint->toArray() : null;

            if (intval($column->CHARACTER_MAXIMUM_LENGTH) > 255
                || in_array($column->DATA_TYPE, $this->largeDataTypes)) {
                $properties['is-on-index'] = false;
            }

            $collection[] = $properties;
        }

        $localeGroup = Helpers::makeLocaleGroup($this->tableName);

        $fields = FieldTransformer::fromArray($collection, $localeGroup, $this->languages);

        // At this point we constructed the fields collection with the default html-type
        // We need to set the html-type using the config::getEloquentToHtmlMap() setting
        $this->setHtmlType($fields);

        return $fields;
    }
protected function getTransfredFields ( array $ columns ) { $ collection = [ ] ; foreach ( $ columns as $ column ) { // While constructing the array for each field // there is no need to set translations for options // or even labels. This step is handled using the FieldTransformer $ properties [ 'name' ] = $ column -> COLUMN_NAME ; $ properties [ 'is-nullable' ] = ( $ column -> IS_NULLABLE == 'YES' ) ; $ properties [ 'data-value' ] = $ column -> COLUMN_DEFAULT ; $ properties [ 'data-type' ] = $ this -> getDataType ( $ column -> DATA_TYPE , $ column -> COLUMN_TYPE ) ; $ properties [ 'data-type-params' ] = $ this -> getPrecision ( $ column -> CHARACTER_MAXIMUM_LENGTH , $ column -> DATA_TYPE , $ column -> COLUMN_TYPE ) ; $ properties [ 'is-primary' ] = in_array ( $ column -> COLUMN_KEY , [ 'PRIMARY KEY' , 'PRI' ] ) ; $ properties [ 'is-index' ] = ( $ column -> COLUMN_KEY == 'MUL' ) ; $ properties [ 'is-unique' ] = ( $ column -> COLUMN_KEY == 'UNI' ) ; $ properties [ 'is-auto-increment' ] = ( $ column -> EXTRA == 'AUTO_INCREMENT' ) ; $ properties [ 'comment' ] = $ column -> COLUMN_COMMENT ? : null ; $ properties [ 'options' ] = $ this -> getHtmlOptions ( $ column -> DATA_TYPE , $ column -> COLUMN_TYPE ) ; $ properties [ 'is-unsigned' ] = ( strpos ( $ column -> COLUMN_TYPE , 'unsigned' ) !== false ) ; $ constraint = $ this -> getForeignConstraint ( $ column -> COLUMN_NAME ) ; $ properties [ 'foreign-constraint' ] = ! is_null ( $ constraint ) ? $ constraint -> toArray ( ) : null ; if ( intval ( $ column -> CHARACTER_MAXIMUM_LENGTH ) > 255 || in_array ( $ column -> DATA_TYPE , $ this -> largeDataTypes ) ) { $ properties [ 'is-on-index' ] = false ; } $ collection [ ] = $ properties ; } $ localeGroup = Helpers :: makeLocaleGroup ( $ this -> tableName ) ; $ fields = FieldTransformer :: fromArray ( $ collection , $ localeGroup , $ this -> languages ) ; // At this point we constructed the fields collection with the default html-type // We need to set the html-type using the config::getEloquentToHtmlMap() setting $ this -> setHtmlType ( $ fields ) ; return $ fields ; }
Gets the field after transfering it from a given query object.

@param object $column

@return CrestApps\CodeGenerator\Model\Field;
Gets the field after transfering it from a given query object .