I've started learning laminas by reading it's documentation (Album
model and table). I have a product
model and I want to fetch the records but the problem is that the name of my table is tbl_product
and I get this error:
Statement could not be executed (42S02 - 1146 - Table 'project.product' doesn't exist)
Where can I define the table name?
Supposing that by "reading it's documentation" you are talking about Laminas' tutorial, then the answer can be found under the the Database and Models section
When you define a new model, you must update the module's configuration, specifying where the application will find the model's factory and gateway:
The class that contains the db table information is
TableGateway
, which constructor is:The first parameter is the table's name.
Hence, in your configuration, you need something like: