# \[SOLVED\] Cakephp 4: Call to undefined method TableSchema::column()

**URL:** <https://discourse.cakephp.org/t/solved-cakephp-4-call-to-undefined-method-tableschema-column/10896>\
**Category:** Need Help\
**Created:** [January 12, 2023, 8:11pm UTC](https://discourse.cakephp.org/t/solved-cakephp-4-call-to-undefined-method-tableschema-column/10896 "2023-01-12T20:11:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![theasy](https://avatars.discourse-cdn.com/v4/letter/t/77aa72/32.png) [@theasy](https://discourse.cakephp.org/u/theasy)\
**Post date:** [January 12, 2023, 8:11pm UTC](https://discourse.cakephp.org/t/solved-cakephp-4-call-to-undefined-method-tableschema-column/10896/1 "2023-01-12T20:11:44Z")

</div>

```auto
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

---

<div class="post-metadata">

**Author:** ![KevinPfeifer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kevinpfeifer/32/3365_2.png) [@KevinPfeifer](https://discourse.cakephp.org/u/KevinPfeifer)\
**Post date:** [January 12, 2023, 9:06pm UTC](https://discourse.cakephp.org/t/solved-cakephp-4-call-to-undefined-method-tableschema-column/10896/2 "2023-01-12T21:06:17Z")

</div>

use `->getColumn($column)` instead of `->column($column)`  
[https://api.cakephp.org/4.3/class-Cake.Database.Schema.TableSchema.html#getColumn()](https://api.cakephp.org/4.3/class-Cake.Database.Schema.TableSchema.html#getColumn())

---

<div class="post-metadata">

**Author:** ![theasy](https://avatars.discourse-cdn.com/v4/letter/t/77aa72/32.png) [@theasy](https://discourse.cakephp.org/u/theasy)\
**Post date:** [January 12, 2023, 9:33pm UTC](https://discourse.cakephp.org/t/solved-cakephp-4-call-to-undefined-method-tableschema-column/10896/3 "2023-01-12T21:33:34Z")

</div>

many thanks kevin, for your great support here, new syntax ^^
