Does anyone knows how to get table name from model name? Also I want to get all column names and its types of that model/table name. Is it possible to get such details of given model name?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Table Name
To get the table, see
Or check the model for the class variable
$useTable. If that’s undefined, then you can infer it from the name of the model:See the Inflector documentation for similarly useful methods.
Columns
Take a look at the schema method of the Model class. For example: