public function getFields($table = null, $ignoreAI = false)
    {
        if ($this->fields === null) {
            $table = $table ?: $this->table;

            $this->fields = $this->db->getTable($table)->getColumnDetails();
        }

        $fields = [];

        foreach ($this->fields as $field) {
            if ($ignoreAI && $field->Extra === 'auto_increment') {
                continue;
            }

            if (strtolower($field->Null) === 'no' && $field->Default === null
                && $field->Key !== 'PRI' && $this->getKeyName() !== $field->Field) {
                $type = $field->Type;

                list($type,) = explode('(', $type, 2);
                $type = strtolower($type);

                $field->Default = $this->db->getTable($table)->getDataType()->getDefaultValue($type);
            }

            $field = (object) $field;
            $fields[$field->Field] = $field;
        }

        return $fields;
    }
public function getFields($table = null, $ignoreAI = false)
    {
        if ($this->fields === null) {
            $table = $table ?: $this->table;

            $this->fields = $this->db->getTable($table)->getColumnDetails();
        }

        $fields = [];

        foreach ($this->fields as $field) {
            if ($ignoreAI && $field->Extra === 'auto_increment') {
                continue;
            }

            if (strtolower($field->Null) === 'no' && $field->Default === null
                && $field->Key !== 'PRI' && $this->getKeyName() !== $field->Field) {
                $type = $field->Type;

                list($type,) = explode('(', $type, 2);
                $type = strtolower($type);

                $field->Default = $this->db->getTable($table)->getDataType()->getDefaultValue($type);
            }

            $field = (object) $field;
            $fields[$field->Field] = $field;
        }

        return $fields;
    }
public function getFields ( $ table = null , $ ignoreAI = false ) { if ( $ this -> fields === null ) { $ table = $ table ? : $ this -> table ; $ this -> fields = $ this -> db -> getTable ( $ table ) -> getColumnDetails ( ) ; } $ fields = [ ] ; foreach ( $ this -> fields as $ field ) { if ( $ ignoreAI && $ field -> Extra === 'auto_increment' ) { continue ; } if ( strtolower ( $ field -> Null ) === 'no' && $ field -> Default === null && $ field -> Key !== 'PRI' && $ this -> getKeyName ( ) !== $ field -> Field ) { $ type = $ field -> Type ; list ( $ type , ) = explode ( '(' , $ type , 2 ) ; $ type = strtolower ( $ type ) ; $ field -> Default = $ this -> db -> getTable ( $ table ) -> getDataType ( ) -> getDefaultValue ( $ type ) ; } $ field = ( object ) $ field ; $ fields [ $ field -> Field ] = $ field ; } return $ fields ; }
Get table fields.

@param string $table    Table name.
@param bool   $ignoreAI Ignore auto increment fields.

@return array
Get table fields .