protected function getTableColumns(array $indexes = [], ?string $schema = null): array
    {
        $columns = [];

        if ($this->tableSchema instanceof TableSchema) {
            $indexData = !empty($indexes) ? $indexes : $this->getTableIndexes();

            foreach ($this->tableSchema->columns as $column) {
                $isUnique = false;

                foreach ($indexData as $index) {
                    if ($index->unique && $index->columns[0] === $column->name && count($index->columns) === 1) {
                        $isUnique = true;

                        break;
                    }
                }

                $columns[$column->name] = TableColumnFactory::build([
                    'schema' => $schema,
                    'name' => $column->name,
                    'type' => $column->type,
                    'size' => $column->size,
                    'precision' => $column->precision,
                    'scale' => $column->scale,
                    'isNotNull' => $column->allowNull ? null : true,
                    'isUnique' => $isUnique,
                    'check' => null,
                    'default' => $column->defaultValue,
                    'isPrimaryKey' => $column->isPrimaryKey,
                    'autoIncrement' => $column->autoIncrement,
                    'isUnsigned' => $column->unsigned,
                    'comment' => $column->comment ?: null,
                ]);
            }
        }

        return $columns;
    }
protected function getTableColumns(array $indexes = [], ?string $schema = null): array
    {
        $columns = [];

        if ($this->tableSchema instanceof TableSchema) {
            $indexData = !empty($indexes) ? $indexes : $this->getTableIndexes();

            foreach ($this->tableSchema->columns as $column) {
                $isUnique = false;

                foreach ($indexData as $index) {
                    if ($index->unique && $index->columns[0] === $column->name && count($index->columns) === 1) {
                        $isUnique = true;

                        break;
                    }
                }

                $columns[$column->name] = TableColumnFactory::build([
                    'schema' => $schema,
                    'name' => $column->name,
                    'type' => $column->type,
                    'size' => $column->size,
                    'precision' => $column->precision,
                    'scale' => $column->scale,
                    'isNotNull' => $column->allowNull ? null : true,
                    'isUnique' => $isUnique,
                    'check' => null,
                    'default' => $column->defaultValue,
                    'isPrimaryKey' => $column->isPrimaryKey,
                    'autoIncrement' => $column->autoIncrement,
                    'isUnsigned' => $column->unsigned,
                    'comment' => $column->comment ?: null,
                ]);
            }
        }

        return $columns;
    }
protected function getTableColumns ( array $ indexes = [ ] , ? string $ schema = null ) : array { $ columns = [ ] ; if ( $ this -> tableSchema instanceof TableSchema ) { $ indexData = ! empty ( $ indexes ) ? $ indexes : $ this -> getTableIndexes ( ) ; foreach ( $ this -> tableSchema -> columns as $ column ) { $ isUnique = false ; foreach ( $ indexData as $ index ) { if ( $ index -> unique && $ index -> columns [ 0 ] === $ column -> name && count ( $ index -> columns ) === 1 ) { $ isUnique = true ; break ; } } $ columns [ $ column -> name ] = TableColumnFactory :: build ( [ 'schema' => $ schema , 'name' => $ column -> name , 'type' => $ column -> type , 'size' => $ column -> size , 'precision' => $ column -> precision , 'scale' => $ column -> scale , 'isNotNull' => $ column -> allowNull ? null : true , 'isUnique' => $ isUnique , 'check' => null , 'default' => $ column -> defaultValue , 'isPrimaryKey' => $ column -> isPrimaryKey , 'autoIncrement' => $ column -> autoIncrement , 'isUnsigned' => $ column -> unsigned , 'comment' => $ column -> comment ? : null , ] ) ; } } return $ columns ; }
Returns columns structure.
@param TableIndex[] $indexes
@param string $schema
@return TableColumn[]
@throws InvalidConfigException
Returns columns structure .