I want to store the csv data dynamically into mysql table. According to my csv columns header i want to insert the data into respective columns in mysql table. For this, I need to get all the table fields name from Zend Framework Controller or Model.
I have tried with:
**
$metadata = new Zend\Db\Metadata\Metadata($adapter);
$table = $metadata->getTable($tableName);
$table->getColumns();
**
But, it shows the error:
Fatal error: Class 'Import\Model\Zend\Db\Metadata\Metadata' not found.
How can I get all the mysql table fields name using Zend Framework 2?
you have to use a backslash before zend correct one :
$metadata = new \Zend\Db\Metadata\Metadata($adapter);