Magento 2 Database – Get All Column Names of Table

blocksdatabasemagento2

I created a custom form in admin using block(without UI component). So i want to get all columns of my custom table in form block file. Please suggest me.

Best Answer

Try this add New function in your custom resource model and call that function where you want to display.

public function getFields() { $fields = $this->getConnection()->describeTable($this->getMainTable()); return $fields; }

Related Topic