Database model classes triggered from handler classes are used for write, read, update and delete operations. A model class can contain more than one function. Before a model can work, it must be defined in the App/ConfigProvider.php file as follows.
public function getDependencies() : array
{
return [
'factories' => [
// Models
//
Model\CompanyModel::class => function ($container) {
$dbAdapter = $container->get(AdapterInterface::class);
$companies = new TableGateway('companies', $dbAdapter, null, new ResultSet(ResultSet::TYPE_ARRAY));
$columnFilters = $container->get(ColumnFilters::class);
return new Model\CompanyModel($companies, $columnFilters);
},
]
];
}