use Cake\Database\Schema\TableSchema;
use Cake\Database\Schema\TableSchemaInterface;
use Cake\Database\Type\ColumnSchemaAwareInterface;
//Get SQL Table-Schema
$tableSchema = $tableModel->getSchema();
//Get columns list from table
$columns = $tableSchema->columns();
//Empty array for fields
$fields = [];
//iterate columns
foreach ( $columns as $column ) {
$fields[ $column ] = $tableSchema->column( $column );
}
return $fields
Cake 4.3.11